Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Power Query - Excel - Passing a variable to the middle of URL datasource

Hi, All!

 

I drilled down an item in a query, which I'd like to add it to datasource's URL to make it dynamic.

I can't find the right syntax. can anyone please help how to pass the variable?

Screenshots below - drill down query is called [aaa_report] and I wanted to add it to replace the month in the URL  (which in this case is june_2019)

 

In addition, is there any way to ensure this drill-down query gets called first once refreshed all?

 

Thank you!

 

  • assuming the query that returns june_2019 is named prmQuery, the path string should change from

    "d:\my Documents\project\june_2019\df\total.csv"

    to

    "d:\my Documents\project\" & prmQuery & "\df\total.csv"

    if other queries are dependant on it PowerQuery will manage the order automatically

4 Replies

  • Stachu's avatar
    Stachu
    Icon for Community Champion rankCommunity Champion

    assuming the query that returns june_2019 is named prmQuery, the path string should change from

    "d:\my Documents\project\june_2019\df\total.csv"

    to

    "d:\my Documents\project\" & prmQuery & "\df\total.csv"

    if other queries are dependant on it PowerQuery will manage the order automatically

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks Stachu 

       

      It looks like I am missing something; when I added query in "& query &" - I got firewall exemption. I do have access to the file obviously - any way to circumvent this error? Thanks again!

       

    • Anonymous's avatar
      Anonymous
      Not applicable

      Stachu , BIG THANK YOU! :smileyhappy: