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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
jpaguiar79
New Member

Distinctcount in a column based on the other column

Hello community,

I have a table with these columns below and need to know how many unique employees per qty of hours.

jpaguiar79_0-1699556617782.png

 

Result should be: 3 employees with 189 hours (A, B, C) and 2 employees with 168 hours (D, E).

 

This is already a filtered table (by country). Field "hours" is a measure.

 

I tried Distinctcount with filter, countrows, etc.

 

THANKS!

1 ACCEPTED SOLUTION
jpaguiar79
New Member

Solution:

 

VAR _ctmax = CALCULATE(DISTINCTCOUNT('table1'[employee]),FILTER('table1','table1'[hours] = 189))

VAR _ctmin = CALCULATE(DISTINCTCOUNT('table1'[employee]),FILTER('table1','table1'[hours] = 168))

 

And I put 189 and 168 into another VARs before these sentences to make sure I get max and min.
Thanks!

View solution in original post

1 REPLY 1
jpaguiar79
New Member

Solution:

 

VAR _ctmax = CALCULATE(DISTINCTCOUNT('table1'[employee]),FILTER('table1','table1'[hours] = 189))

VAR _ctmin = CALCULATE(DISTINCTCOUNT('table1'[employee]),FILTER('table1','table1'[hours] = 168))

 

And I put 189 and 168 into another VARs before these sentences to make sure I get max and min.
Thanks!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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