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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
DJL
Regular Visitor

Combine files from different folders + Add a column with file path

Hi all,

 

I have a scenario where a monthly CSV dataset is generated from a system.  For audit purposes, this dataset is then stored into a corresponding monthly folder on SharePoint, eg: Jan 2022, Feb 2022, Mar 2022 and so on.  This data underpins various reporting products and an objective is to automate pulling the latest months' data into a Power BI report.

 

The file name is always the same, let's call it 'Audit Dataset'.  So, I tested out a technique which involves searching for that string in the File Name field, to filter down.  This works well in identifying the file across multiple folders - so I'm half way there 🙂  However, I need to be able to differentiate time periods and for that, pull in the folder name 'ie: Mar 2022' and have that as a column within the appended dataset.

 

But I can't see a way to reference the source file path and align that as a new column.  If I could do that, I'd simply just trim the end of it to create my Reporting Month column - voila, job done.

 

Any thoughts / help most appreciated...

 

Thanks 🙂

1 ACCEPTED SOLUTION
mussaenda
Super User
Super User

Hi @DJL,

 

of course you can do that.

If you are pulling data using Folder instead of single file,

You can see these applied steps:

mussaenda_0-1649495766313.png

 

then on the removed other columns,

select also the folder path so it will not be removed.

 

mussaenda_1-1649495867984.png

 

viola, job done.

 

hope this helps.

 

View solution in original post

2 REPLIES 2
mussaenda
Super User
Super User

Hi @DJL,

 

of course you can do that.

If you are pulling data using Folder instead of single file,

You can see these applied steps:

mussaenda_0-1649495766313.png

 

then on the removed other columns,

select also the folder path so it will not be removed.

 

mussaenda_1-1649495867984.png

 

viola, job done.

 

hope this helps.

 

Hi Mussaenda,

 

That's brilliant - works a charm!

 

Thanks for the help, very much appreciated 😎

 

DJL

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.