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
Anonymous
Not applicable

DISTINCTCOUNT with 2 different tables?

I can seem to make work      DISTINCTCOUNT ( Employee[Dept] ).

 

 

I have 2 tables:

 

AD table:

AD group

Employee

ITPJohn
ADMIRTim
ADMIRMary
ADMIRJohana
TJJAria
TJJArmeena
TJJJuana

 

 

 

 

Employee table:

 

Employee

Dept

JohnMarketing
TimMarketing
MaryMarketing
JohanaHR
AriaHR
ArmeenaHR
JuanaHR

 

(The tabled are connected through column Employee)

 

It is a 1 to many relationship.

 

I just want to count distinct dept on each AD group.

 

That is:

 

ITP      1

ADMIR     2

TJJ    1

 

I have used  DISTINCTCOUNT ( Employee[Dept] ) and then I drag AD group to the table and it doesnt work.

 

How can I make DISTINCTCOUNT work when using 2 tables?

1 ACCEPTED SOLUTION
DimaMD
Solution Sage
Solution Sage

Hi @Anonymous If your tables are not connected, then you can use this measure

CALCULATE( 
    DISTINCTCOUNT ( 'Employee table'[Dept] ), 
     TREATAS( VALUES('AD table'[Employee]),'Employee table'[Employee])
)

Screenshot_1.jpg


__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com

View solution in original post

5 REPLIES 5
DimaMD
Solution Sage
Solution Sage

Hi @Anonymous If your tables are not connected, then you can use this measure

CALCULATE( 
    DISTINCTCOUNT ( 'Employee table'[Dept] ), 
     TREATAS( VALUES('AD table'[Employee]),'Employee table'[Employee])
)

Screenshot_1.jpg


__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com
Greg_Deckler
Community Champion
Community Champion

@Anonymous Try:

Measure = COUNTROWS(DISTINCT('Employee'[Dept]))


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler  does not seem to work, I get value 2   for all. It seems that because the column is from another table the distinctcoutn does not work.

@Anonymous Try the attached PBIX below sig. 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Anonymous Is this a measure or a calculated column? If calculated column you will need to use RELATED.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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.