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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Anonymous
Not applicable

Conditional Merge Multiple Queries

Hello,

 

I have two queries that need merged based on a value in a cell.

 

I need the rows in Query B to be inserted under the row in Query A when a specific cell matches.

 

For example in Query A in a column I have the value 123, next row 456, third row 789. In Query B I have the same values but different columns. Can the queries be combined in which the row from Query A is row 1, then the row from query B that matches is row 2. Then third line is the second value in Query A with the second value in Query B in row four?

 

 

For example below:

Second column matches in both queries. I need Query A as the first record and then Query B that has the same corresponding second column value to be the next line and so on.

Query A

Ahamor_0-1666042024794.png

 

Query B

Ahamor_1-1666042050022.png

 

Thanks so much.

 

1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi @Anonymous ,

Pls refer the below:

base table:

vluwangmsft_0-1666088565345.png

vluwangmsft_1-1666088578537.png

 

 

Outputresult:

vluwangmsft_2-1666088595795.png

 

You could download my pbix file to learn the details operations.

 

 

Best Regards

Lucien

 

View solution in original post

1 REPLY 1
v-luwang-msft
Community Support
Community Support

Hi @Anonymous ,

Pls refer the below:

base table:

vluwangmsft_0-1666088565345.png

vluwangmsft_1-1666088578537.png

 

 

Outputresult:

vluwangmsft_2-1666088595795.png

 

You could download my pbix file to learn the details operations.

 

 

Best Regards

Lucien

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.