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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
JJH_
Frequent Visitor

Dynamically load files using dynamic cell value

I am trying to automate loading 2 files dynamically into a daily process.

Given that each file has a date stamp and is stored in the same folder directory, I was able to use Power Query to create a new column called 'File Date' to dynamically identify today and last business day's files, as seen in below screen print.

 

JJH__0-1603721014940.png

 

 

I now need to reference cell C2 & C3 to load both files in for further data transformation.

Any suggestions on how to go about loading both files? The "CompleteFilePath" column contains the entire file path "C:\Users..\..csv

1 REPLY 1
PhilipTreacy
Super User
Super User

Hi @JJH_ 

Given that you've written a query that has the paths/filenames of the 2 files you want, do you need to write them out to Excel at all?

You can just extract both filenames from the query and use them in subsequent queries.

Once you've reduced the query to just the 2 filenames you want, add an Index Column (here's an example from my PC)

files.png

Then duplicate the query.

Filter the first query to just give you the 1st file, and filter the 2nd query to give you the 2nd file.

You now have 2 queries whose outputs are the names/paths of the 2 files you need.

Cheers

Phil


If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
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.