Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin 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.
I can seem to make work DISTINCTCOUNT ( Employee[Dept] ).
I have 2 tables:
AD table:
AD group | Employee |
| ITP | John |
| ADMIR | Tim |
| ADMIR | Mary |
| ADMIR | Johana |
| TJJ | Aria |
| TJJ | Armeena |
| TJJ | Juana |
Employee table:
Employee | Dept |
| John | Marketing |
| Tim | Marketing |
| Mary | Marketing |
| Johana | HR |
| Aria | HR |
| Armeena | HR |
| Juana | HR |
(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?
Solved! Go to Solution.
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])
)
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])
)
@Anonymous Try:
Measure = COUNTROWS(DISTINCT('Employee'[Dept]))
@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.
@Anonymous Is this a measure or a calculated column? If calculated column you will need to use RELATED.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 11 | |
| 9 | |
| 8 | |
| 7 | |
| 7 |