Forum Discussion

ngadiez's avatar
ngadiez
Helper II
8 years ago

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.

 

5 Replies

  • Phil_Seamark's avatar
    Phil_Seamark
    Microsoft Employee

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

    • ngadiez's avatar
      ngadiez
      Helper II

      Phil_Seamark

       

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

       

      Thanks

      • Phil_Seamark's avatar
        Phil_Seamark
        Microsoft Employee

        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

         

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

        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.