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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
stribor45
Post Prodigy
Post Prodigy

Unique values in each table

I am trying to find unique values in each tables. So for example get unique id's in table A and do the same for table B. Now I want to make sure when I count these ID's not to count them twice since  same ids can be in each table. I know what I need to use base table for this code but cant sedem to understand how to resolve this. Can anyone assist please 

 

DEFINE 

VAR A = VALUES('Table A'[ID])
VAR B = VALUES('Table B'[ID])
VAR C = UNION(A,B)
VAR D = DISTINCTCOUNT(C[ID])

EVALUATE 
D
1 ACCEPTED SOLUTION
Irwan
Super User
Super User

hello @stribor45 

 

please check if this accomodate your need.

i made a simple dataset.

Irwan_0-1745191532274.pngIrwan_1-1745191555634.png

based on above dataset, the distinct count should be 11.

 

i assumed you want to do this in measure, so create a new measure with following DAX.

Irwan_2-1745191703474.png

 

Hope this will help.

Thank you.

View solution in original post

4 REPLIES 4
v-hashadapu
Community Support
Community Support

Hi @stribor45 , Thank you for reaching out to the Microsoft Community Forum.

Please let us know if your issue is solved. If it is, consider marking the answers that helped 'Accept as Solution', so others with similar queries can find them easily. If not, please share the details.
Thank you.

stribor45
Post Prodigy
Post Prodigy

This works but how does the outer DISTINCT know that we are talkinjg about ID column? Is it because it is only one column?

hello @stribor45 

 

i might be misunderstood but you can target the value you want to calculate the distinct value.

 

otherwise, please share your sample dataset and your expected outcome.

 

Thank you.

Irwan
Super User
Super User

hello @stribor45 

 

please check if this accomodate your need.

i made a simple dataset.

Irwan_0-1745191532274.pngIrwan_1-1745191555634.png

based on above dataset, the distinct count should be 11.

 

i assumed you want to do this in measure, so create a new measure with following DAX.

Irwan_2-1745191703474.png

 

Hope this will help.

Thank you.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.