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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
annatan
New Member

Power Query - Dynamically referring to correct file name in one drive

Hi,

Can I have your help on dynamically referring to correct file name in one drive?

Situation

In one drive, there are multiple file created, such as the file name ending with "2025 - 06" and "2025 - 07" and "2025 - 08" and etc.
And I have a financial schedule, like "2025 - 07" file will not be final until Aug 13, therefore, I initiated a schedule table depending on the current date, like today is Aug 9, we use "2025 - 06". Then starting on Aug 13, we can use "2025 - 07" file.
In Power query, I have connected to schedule table and initiate a new query to look for version based on the current date. Today is Aug 9, so we use version 06. Finally, turn 06 as text "Today Version" in the new query.

Question

In the query which I connected to file, the source step has the following path
"\\mob\2025 - 06.xlsx"

I would like to dynamically change the file path by replacing 06 with "Today Version", and I have tried this

"\\mob\2025 - " & Today Version & ".xlsx"

But it was not working. I have this error message

 

Expression.SyntaxError: Token',' expected.

 

Can you please help me to see if I missed anything there? Thanks,

3 REPLIES 3
annatan
New Member

Please ignore my inquiry. I figured it out now. 

MasonMA
Solution Sage
Solution Sage

Hello @annatan 

 

If in your situation I would create a Parameter (FileVersion) in Power Query and use it in the source.

For Parameter, set its default value from your schedule table and reference this parameter in the file path as in below M. 

let
    Source = Excel.Workbook(File.Contents("\\mob\2025 - " & FileVersion & ".xlsx"), null, true),
    ...
in
    Source

 

If you would like to try this, please also make sure "Today Version" is a single text value and verify the path syntax.

 

Hope it helps:)

Hi @MasonMA 

 

May I know what you meant by "For Parameter, set its default value from your schedule table"? Do I need to manually input the version value from schedule table? I would like it to be dynamic and controlled by the schedule table automatically. 

 

Thanks,

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 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.

Top Solution Authors
Top Kudoed Authors