Date from Text String

Qqqqq

New Member
Joined
Feb 6, 2014
Messages
48
I'm brand new to Power Query, and I need to add a date column to my data. The tables that my data is built from are named with the last 6 digits representing the year and month. From the table name, I would like to get the last date of the month. For example, the September 2020 data is in a table named t_202009, and I would like 9/30/2020 in a new date column.

I tried to use "Add Column From Examples...", but it seemed to require that I give it a new example for every table. This isn't practical, as I want this column to auto populate as new tables are added for future months.

What is the best way to get this result?
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
use XL2BB to post representative example of your source data and expected result or post a link to the shared excel file with the same via onedrive, googledrive or any similar service
 
Upvote 0
My source data has confidential information, so I cannot post it. The data itself has no date. Tables use the naming convention t_YYYYMM. From the table name, I would like to create a date column, assigning the last date of each month to the data entries for that month.
 
Upvote 0
I think I've got it figured out. This formula seems to have done the trick.

= Table.AddColumn(#"Filtered Rows2", "Date", each Date.EndOfMonth(Date.From(Text.AfterDelimiter([Name]&"01", "_"))), type date)
 
Upvote 0

Forum statistics

Threads
1,223,760
Messages
6,174,341
Members
452,555
Latest member
colc007

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top