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
nvizard
Regular Visitor

Count distinct values across two separate rows in two separate tables

Hi all,

I am trying to count the number of distinct values that occur in two separate columns in two separate tables (count the number of distinct values as though the two columns were appended) 

For example, if I had the two columns below :

1                       1

2                       3

3                       5

4                       7

5                       9

 

it should return a count of 7, 3 values were not counted (1,3,5) as they appeared twice.

 

Many thanks for your help

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

@nvizard 

 

You may try the measure below.

Measure =
COUNTROWS (
    DISTINCT ( UNION ( VALUES ( Table1[Column1] ), VALUES ( Table2[Column1] ) ) )
)

 

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-chuncz-msft
Community Support
Community Support

@nvizard 

 

You may try the measure below.

Measure =
COUNTROWS (
    DISTINCT ( UNION ( VALUES ( Table1[Column1] ), VALUES ( Table2[Column1] ) ) )
)

 

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

just do union of these two columns which will remove duplicates and create new table with unique values.

 

New table=Union(table1,table2)

 

Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar

If I resolve your problem Mark it as a solution and give kudos.

Try one of the two

 

EXCEPT(union(all(table[column1]),all(table[column1])),INTERSECT(all(table[column1]), all(table[column2])))
or
EXCEPT(union(distinct(table[column1]),distinct(table[column1])),INTERSECT(distinct(table[column1]), distinct(table[column2])))

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.