Forum Discussion

Sudharsanan's avatar
Sudharsanan
Helper III
4 years ago
Solved

Dynamic Source path

Hi All,

 

Can someone help me in setting up dynamic source path in power query?. My data will be placed with different folder name.

 

Appreciate your support!!

  • This is how you can use parameters to make a source file name and path dynamic:

     

    Create 2 parameters - one for the file name and one for the file path.

     

     

    Replace the hard-coded file name and path with the parameters.  In this example I am connecting to an Excel file.  

     

3 Replies

Replies have been turned off for this discussion
  • This is how you can use parameters to make a source file name and path dynamic:

     

    Create 2 parameters - one for the file name and one for the file path.

     

     

    Replace the hard-coded file name and path with the parameters.  In this example I am connecting to an Excel file.  

     

  • admdc01's avatar
    admdc01
    Frequent Visitor

    hello, with all due respect this is not dynamic as you are stating "hard-coded" filename. As far as i know there is no direct way to implement dynamic links in power bi. 
    On the contrary.. in excel power query there is a solution which might be applied in Power BI.

    Create an excel file named parameters and save it at the same place as the pbix file;

    Name  cell A1 : folderPath

    type the following formula in that cell
     =LEFT(CELL("filename";A1);FIND("[";CELL("filename";A1))-1)

    That formula gets the excel file path 🙂 which is dynamic as it updates whenever you move the excel file from one folder to another.

    In Power BI, connect the excel file and read the content of the cell named folderPath --> your dynamic path is now active