Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
WaheedAli
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
v-deddai1-msft
Community Support
Community Support

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
v-deddai1-msft
Community Support
Community Support

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

 

 

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 🙂

negi007
Community Champion
Community Champion

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.