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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
yuanye0710
Frequent Visitor

Count distinct items from 1 column that don't exist in another column

Hi, I'd like to write a measure to calculate total distinct items from 1 column that not found in another column. 2 columns are from different tables.

 

I was able to do this my adding a calculated helper column, but just wondering if there is any way to do it without adding an extra column.

 

For example:

Column A from table 1

-----------

AA

AA

AA

BB

CC

CC

DD

DD

EE

 

Column B from table 2

-----------

AA

AA

BB

BB

FF

 

I want to count distinct items from Column A not found in Column B.

 

There are 5 items in Column A not found in Column B:  

-----------

AA

AA

AA

BB

CC

CC

DD

DD

EE

 

And there are 3 distinct counts: CC DD and EE, so the measure should return 3.

 

Thanks!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@yuanye0710 , except can help

 

In A not in B

a new table = except(distinct(TableA[COlumn]), distinct(TableB[COlumn]) )

 

measure

 

a new table = Countrows(except(distinct(TableA[COlumn]), distinct(TableB[COlumn]) ) )

 

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@yuanye0710 , except can help

 

In A not in B

a new table = except(distinct(TableA[COlumn]), distinct(TableB[COlumn]) )

 

measure

 

a new table = Countrows(except(distinct(TableA[COlumn]), distinct(TableB[COlumn]) ) )

 

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Thanks a lot! it's working for me! 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.

Top Solution Authors