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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Charu
Post Patron
Post Patron

Passing value from one query to other query via parameter

Dear Community,

 

Is it possible to pass the value from one query to another query's where condition? 

From query 1 values must be dynamic in query 2 where condition.

 

For example:

query1- select * from table1

query2- select * from table2 where id = table1.id AND orgid = table1.orgid

 

Thanks in advance

1 ACCEPTED SOLUTION

Hi @Charu ,

 

You can refer to this case and a document in it. You can treat QUERY 1 as a parameter.

https://community.powerbi.com/t5/Desktop/Pass-List-Value-through-SQL-Statement-without-Parameter/m-p...

 

Best Regards,

Eads

 

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

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

3 REPLIES 3
v-eachen-msft
Community Support
Community Support

Hi @Charu ,

 

When you are ready to connect to database, you can click the Advanced options.1-1.PNG

Then use the following query in the SQL statement.

select b.* from table1 a,table2 b where a.id=b.id and a.orgid=b.orgid

You can get result you want.

 

Best Regards,

Eads

 

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

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

Hi @v-eachen-msft 

 

query 1 and query 2 - I will connect both as different datasource.

That is first i will connect query1 and then I will connect query 2.So I don't think I can write a sql statement combining it.

Hi @Charu ,

 

You can refer to this case and a document in it. You can treat QUERY 1 as a parameter.

https://community.powerbi.com/t5/Desktop/Pass-List-Value-through-SQL-Statement-without-Parameter/m-p...

 

Best Regards,

Eads

 

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

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors