cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper I
Helper I

Query referencing another query

Hi, I am new with Microsoft Power BI so please bear with me. What I am trying to do is, I have a query (Web-API) through which I am getting some data and now I need to make another query, which is basically many queries, based on a variable from the first query-table.

In other words query A has a column, which I want to use as variable to make 2nd (multiple) queries, using query A's one column contents. Now when I try to do that by converting query A's that column in to a list and creating a parameter which refers to that list and when I try to run the query it gives and error that (something like) your query is refering to another query.

Can someone help me how to overcome that? Bascially the source for both queries are the same. I just want to use the 1st query's one column as variable for another query, so I can make multiple queries. Thanks in advance.

1 ACCEPTED SOLUTION
Microsoft
Microsoft

Hi @WaheedAli ,

 

You can c convert your second query to a funciton (follow the steps in https://radacad.com/custom-functions-made-easy-in-power-bi-desktop) 

 

Then , In your first query with the list of IDs, go to Add Column > Invoke Custom Function, choose the function you just made as the function query, and change the table drop down from text to column name and select the variable column in first query .

 

For more details, please refer to the similar post :https://community.powerbi.com/t5/Desktop/JSON-query-based-on-another-query/td-p/177461

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

 

 

View solution in original post

4 REPLIES 4
Microsoft
Microsoft

Hi @WaheedAli ,

 

You can c convert your second query to a funciton (follow the steps in https://radacad.com/custom-functions-made-easy-in-power-bi-desktop) 

 

Then , In your first query with the list of IDs, go to Add Column > Invoke Custom Function, choose the function you just made as the function query, and change the table drop down from text to column name and select the variable column in first query .

 

For more details, please refer to the similar post :https://community.powerbi.com/t5/Desktop/JSON-query-based-on-another-query/td-p/177461

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Best Regards,

Dedmon Dai

 

 

View solution in original post

Dear Dedmon Dai,

 

Thank a lot man... yahoooooo... I have done with your help. Since I am a network eng and not a programmer so i would have never done it without your help. Much appreciated. Thanks a lot 🙂

Super User II
Super User II

Dear negi007,

Thanks a lot for guiding me but on the mentioned links, on the first link, it says the below. So I am not sure it will help me or not but thanks a lot for guiding me. I learnt a lot from it, since I am new with Power BI. Thanks

 

"Currently, only a static list of Accepted Values (or any value of the expected type) are accepted. In future updates, we will enable users to bind the list of Accepted Values for a parameter to the output of another query. This would enable dynamic sets of options to be displayed to the user, maybe even based on their selection for a previous parameter. A typical example for this would be making a “City” parameter change the list of values to select from, based on another parameter that allows users to specify a “State”. Also in a future update, we will enable users to select more than one value from the list of Accepted Values, rather than just one as it is the case in the current product version."

Helpful resources

Announcements
secondImage

Congratulations!

We are excited to announce the Power BI Super Users!

Wave Release 2

Check out the updates in Power BI.

Overview of Power BI 2020 release wave 2!

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors