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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Isambard
Helper I
Helper I

Power Query Custom Column with Data Source

Hi,

 

I'm hoping this is really easy for someone with more experience than me. I'm taking data from a few dozen excel spreadsheets, each with a 20 named tables. I have set this up in power query and the data is coming through - one power query table for each excel table which is what I want.

 

I would realy like to add a collumn to each table specifiying the name of the excel file it came from so I'll be able to slice this back out later on. Is there a simple function or toggle somewhere that would let me include the source file name with my data?

 

Thanks for any help.

1 ACCEPTED SOLUTION
Minseven07
Frequent Visitor

I see. Can you get your data in a folder then filter on that specific excel file? If yes, you will have access to the folder path and the file name.

 

Minseven07_0-1706610475874.png

 

View solution in original post

5 REPLIES 5
kleigh
Resolver IV
Resolver IV

The name of the Excel file doesn't come at the step of Excel.Workbook, it's one before when you have your folder of Excel files. I think the usual thing is to combine by drilling into the Binary column, but it's also possible to create a new custom column with Excel.Workbook([Content]), remove the file information you don't need (including the raw Content), then expand your custom column. You'll also need to expand and combine your Excel tables in a way that preserves the file information as a column.

Minseven07
Frequent Visitor

I see. Can you get your data in a folder then filter on that specific excel file? If yes, you will have access to the folder path and the file name.

 

Minseven07_0-1706610475874.png

 

This works perfectly. Thank you.

Minseven07
Frequent Visitor

in your query editor, when you get your source file, you have access to the folder path and the file name. You can maybe concatenate those column.
If this doesn't help, a pbix file whould be welcome

Thank you. I don't need the file path, just the name would be fine. But I'm not seeing an option to load either of them as collumns. Should this be in the window when I load the data?

 

Sorry I can't post the pbix as its confidential but here are some screenshots:

Isambard_0-1706609723486.pngIsambard_1-1706609821077.png

The data then loads with all the fields from the excel table but not the source name.

 

Thank you.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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