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

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

Reply
annatan
Helper I
Helper I

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,

1 ACCEPTED SOLUTION
annatan
Helper I
Helper I

Please ignore my inquiry. I figured it out now. 

View solution in original post

4 REPLIES 4
v-sdhruv
Community Support
Community Support

Hi @annatan ,

Good to know that you were able to resolve the issue on your own. If you'd like to share with us what worked for you, it would be great! Since this would help the other community members facing the same issue .

Thank you 

annatan
Helper I
Helper I

Please ignore my inquiry. I figured it out now. 

MasonMA
Community Champion
Community Champion

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Kudoed Authors