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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Cofinia
Frequent Visitor

Retain xlsx file name in new column when using Folder as a data source

Hi,

I'm using a folder to import files to PowerBI.

I used the information given on this forum to solve the problem of importing xlsx files

http://exceleratorbi.com.au/combine-excel-workbooks-power-query-method-2/>

 

My files are monthly tial balance that I saved as 20160131.xlsx, 20160229.xlsx, etc

I would like to add a new column to have the date retrieved from the file name.

 

I saw other way with csv files, tried it, but it's not working.

 

Thank you for your help

 

2 REPLIES 2
IvanBond
Advocate II
Advocate II

Hello,

 

when you query From Folder, you have column [Name] in query editor. Left to cut it on pieces with help of functions Text.Start, Text.End, Text.Range.

formula for "20160229.xlsx"

#date( Number.From( Text.Start( [Name], 4    ) ), 
Number.From( Text.Range( [Name], 4, 2 ) ),
Number.From( Text.Range( [Name], 6, 2 ) )
)

BR,

Ivan

Hi IvanBond,

I tried your solution, but I was not able to make it work.

I selected the 8 first digits ans it worked.

Then I change the format to dates.

Thank you for your help.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors