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
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
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.