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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
marbianono
New Member

merging queries question

I have 2 huge SQL queries on my power bi, both for different table, but the 2nd query partially matches the first query in one column "username" is there a way for me to merge both queries were I just use the column username from the 1st query and filterout all the rows that do no match from the 2nd query? I am not talking about replacing the existin 1st and 2nd query but create a 3rd query based on this

1 ACCEPTED SOLUTION
Rayizer
Memorable Member
Memorable Member

@marbianono 

You can do it in two different ways by either  merge as a new query and then filter or create a new SQL query with a left or right join where 2ndQuery.username is null. Basically, the merge is Power BI's join, so you tell it it's a left join on the usernames and then you can filter out the 2nd query's usernames to leave only blanks.

If your join column is something else (an order number, for example), then create a new column "Username" that will check if both values are identical. You can use it to filter.

 

And in SQL, instead of 2ndQuery.username is null, you would then use 1stQuery.username <> 2ndQuery.username

View solution in original post

1 REPLY 1
Rayizer
Memorable Member
Memorable Member

@marbianono 

You can do it in two different ways by either  merge as a new query and then filter or create a new SQL query with a left or right join where 2ndQuery.username is null. Basically, the merge is Power BI's join, so you tell it it's a left join on the usernames and then you can filter out the 2nd query's usernames to leave only blanks.

If your join column is something else (an order number, for example), then create a new column "Username" that will check if both values are identical. You can use it to filter.

 

And in SQL, instead of 2ndQuery.username is null, you would then use 1stQuery.username <> 2ndQuery.username

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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