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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Anonymous
Not applicable

Distinct Count, Filter

I would like to know how many peple have less than 25 hours. 

 

I have a measure that calculates Hours= CALCULATE(ROUND(SUM(Utilisation[NonChargeableHours]),4), Matter[Nonbill Category]="Pro Bono")

 

Then I wrote the below mease to let me count how many people are below 25 hours, however, it is giving me the number of people

 

CALCULATE(DISTINCTCOUNT(WFE[Fee Earner Name]), FILTER(Utilisation,Utilisation[Hours]<25))
 
NameHours
A270
B24
C20
D74
E66
F10
G4
H428
I6

 

The answer should be 5 however, I'm getting 9

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @Anonymous ,

@gmsamborn  offers a good solution. In the meantime I have another approach to your problem that I hope will help you. Based on the information you provided, you are actually on the right path. I have modified your code slightly:

Below 25 hours = 
CALCULATE (
    DISTINCTCOUNT ( 'Table'[Name] ),
    FILTER ( 'Table', 'Table'[Hours] < 25 )
)

Final output:

 

vyifanwmsft_0-1712628088814.png

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Ada Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

Revise the second measure to

Measure = countrows(FILTER(VALUES(WFE[Fee Earner Name]),[Hours]<25))

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Revise the second measure to

Measure = countrows(FILTER(VALUES(WFE[Fee Earner Name]),[Hours]<25))

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi @Anonymous ,

@gmsamborn  offers a good solution. In the meantime I have another approach to your problem that I hope will help you. Based on the information you provided, you are actually on the right path. I have modified your code slightly:

Below 25 hours = 
CALCULATE (
    DISTINCTCOUNT ( 'Table'[Name] ),
    FILTER ( 'Table', 'Table'[Hours] < 25 )
)

Final output:

 

vyifanwmsft_0-1712628088814.png

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Ada Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

gmsamborn
Super User
Super User

Hi @Anonymous 

 

Would this measure help?

 

x = 
COUNTX(
    FILTER(
        'Table',
        'Table'[Hours] < 25
    ),
    'Table'[Name]
)

 

 



Proud to be a Super User!

daxformatter.com makes life EASIER!

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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