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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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