cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Helper III

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

 Name Hours A 270 B 24 C 20 D 74 E 66 F 10 G 4 H 428 I 6

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

2 ACCEPTED SOLUTIONS
Community Support

Hi @kari1282 ,

@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:

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

Best Regards,

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

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
3 REPLIES 3
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
Community Support

Hi @kari1282 ,

@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:

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

Best Regards,

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

Super User

Would this measure help?

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

Announcements

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors
Top Kudoed Authors