Showing results for 
Search instead for 
Did you mean: 
Helper II
Helper II

Refer to a parameter for Comma-Separated Values data source

Hi Everyone,


I cannot find a way to refer a parameter to the file path parts.

Is there any way to do this? Or Power BI Desktop Developer has oversight of this.




Have you tried the Advance Editor and adding a parameter directly to the M code?

To learn more about DAX visit :

Proud to be a Datanaut!



How to add in Parameter in the Advance Editor? I have tried to put just the name of the parameter but it failed.



I created a parameter in the Query Editor.  I called it myParameter and set it to TEXT with a value of c:\temp\a.csv


I then edited the M code via the Advanced Editor and made the change in red.  Note all text is case sensitive


    Source = Csv.Document(File.Contents(myParameter),[Delimiter=",", Encoding=1252])

I could then change the value for the parameter in the query editor to say, c:\temp\b.csv and when I refresh I see the contents of the new file.


Does that help?  I can send a sample PBIX file if you like.

To learn more about DAX visit :

Proud to be a Datanaut!



Thank you so much for your help.


I have done my parameter ValuationDate and it is a number. 

IT is the current month in the form of YYMM. Y stands for year, M stands for month.


Every month there will be new file in the folder with something like Report_1710.csv


I have tried 
Source = Csv.Document(File.Contents("C:\Report_" & Number.ToText(ValuationDate) & ".CSV"),[Delimiter=",", Columns=76, Encoding=1252, QuoteStyle=QuoteStyle.None])


but it is still failed.

Thank you so much again for your help.

Hi @ngadiez


Your M code looks pretty close.  What is the error you are getting?

To learn more about DAX visit :

Proud to be a Datanaut!

Helpful resources

June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors