Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
mousematt
New Member

Extract date from file name and include in a new column

Hi.

 

I have a column that lists file names (as an example '32.1Checkfile_20240302-Exceptions.xlsx').

 

I am trying but keep failing to extract the date from the file name (20240302) and put this into a new column in PBI and format this as a date.

 

Is anyone able to help with a solution? 

 

 

1 ACCEPTED SOLUTION
mousematt
New Member

Perfect.  Thank you so much for your help. 😀

View solution in original post

2 REPLIES 2
mousematt
New Member

Perfect.  Thank you so much for your help. 😀

DataInsights
Super User
Super User

@mousematt,

 

Create a custom column in Power Query with this expression, where Filename is the column name. The argument ChangeType is the previous step name.

 

AddDate = Table.AddColumn(
    ChangeType,
    "Date",
    each Date.FromText(Text.Middle([Filename], Text.PositionOf([Filename], "_") + 1, 8))
)

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.