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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
mateusz_ta
Frequent Visitor

EXCEPT for columns

Hi,

 

I have two tables, t1 and t2, each of them containing multiple, partially different, columns. One of the columns, let's call it A, exists in both tables, but the values of the column A are not completely the same in both tables. Now, I would like to create a new table, t3, with only one column - A - which would contain values from A in t1 which cannot be found in A in t2, something like an INNER JOIN, speaking in SQL terms. How do I proceed?

I was thinking about the EXCEPT statement, but it can be applied only on complete tables. Another idea is to duplicate the tables, delete the unnecessary rows, so that only column A remains and then apply the EXCEPT statement on these duplicates of t1 and t2 but there must be some simpler way. Also, maybe it's worth mentioning that each of the original tables comes from different data sources - csv and SQL Server, so that I have no option to run an inner join earlier in the pipeline.

1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

You can create a measure along the lines of:

 

A only in t1 =
COUNTROWS ( EXCEPT ( VALUES ( 'Table 1'[A] ), VALUES ( 'Table 2'[A] ) ) )

(The function VALUES returns a table of unique values-including blank rows- of the column within)

 

Then create a table visual with the field from Table 1[A], add the measure to the filter pane and set the value to = 1

 

If you need a physical table, use :

 

A only in t1 =
 EXCEPT ( VALUES ( 'Table 1'[A] ), VALUES ( 'Table 2'[A] ) ) 

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

2 REPLIES 2
PaulDBrown
Community Champion
Community Champion

You can create a measure along the lines of:

 

A only in t1 =
COUNTROWS ( EXCEPT ( VALUES ( 'Table 1'[A] ), VALUES ( 'Table 2'[A] ) ) )

(The function VALUES returns a table of unique values-including blank rows- of the column within)

 

Then create a table visual with the field from Table 1[A], add the measure to the filter pane and set the value to = 1

 

If you need a physical table, use :

 

A only in t1 =
 EXCEPT ( VALUES ( 'Table 1'[A] ), VALUES ( 'Table 2'[A] ) ) 

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






vicky_
Super User
Super User

You could use a Merge Queries as New option in Power Query to run an inner join.

https://learn.microsoft.com/en-us/power-query/merge-queries-overview
I think you will have to end up duplicatig one of the tables though.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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