Forum

Create date column ...
 
Notifications
Clear all

Create date column based on file name?

3 Posts
2 Users
0 Reactions
955 Views
(@paranthem)
Posts: 2
New Member
Topic starter
 

Hello,

Does anyone know the method to create a new column in Power Query based off of a source file name?

For example, my source file is named 10.24.2021.xlsx. I want Power Query to generate a new column typed as a date that understands all records associated with that file to have 10/24/2021 as their value.

Thank you.

 
Posted : 28/10/2021 9:50 am
(@mynda)
Posts: 4761
Member Admin
 

Hi John,

Welcome to our forum!

Presumably the source file name is in a column. If so, you can simply use Replace to remove the .xlsx and then format the column as Date data type. If Date data type returns an error, then you can use Replace again to replace the . with /.

Mynda

 
Posted : 28/10/2021 7:53 pm
(@paranthem)
Posts: 2
New Member
Topic starter
 

Oh wow. So simple and effective. Thank you!

 
Posted : 29/10/2021 11:25 am
Share: