cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bryanc78 Regular Visitor
Regular Visitor

Dax - count number of people below 50%

I would like to count how many people are below 50% when I have a column that is listed below.  As you can see, Bob is at 25% and Lucy is at 66% so the count would be 1.  Similar, a % would be good as well so the answer in this case would be 50%

 

Bob SmithPass
Bob SmithFail
Bob SmithFail
Bob SmithFail
Lucy BrownFail
Lucy BrownPass
Lucy BrownPass
1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Dax - count number of people below 50%

Sure. I'll be making up table/column names, so adjust for your data model:

PeopleOver50% = 
COUNTROWS(
    FILTER(
        SUMMARIZE( Results, Results[Person], 
            "Count Pass", CALCULATE(COUNTROWS(Results), Results[Pass/Fail] = "Pass"), 
            "Count Total", COUNTROWS(Results)
        ), 
        [Count Pass]/[Count Total] >= .5
    )
)

 

This measure will give you a direct count of those people with a Pass/Total of greater than or equal to 50%.  I kept all the parts of the percentage calculation separated to allow you to rearrange and use the pieces as needed.  Usually I would calculate the percentage directly instead of storing them separately in the SUMMARIZE table.

 

 

 

4 REPLIES 4
Super User
Super User

Re: Dax - count number of people below 50%

Sure. I'll be making up table/column names, so adjust for your data model:

PeopleOver50% = 
COUNTROWS(
    FILTER(
        SUMMARIZE( Results, Results[Person], 
            "Count Pass", CALCULATE(COUNTROWS(Results), Results[Pass/Fail] = "Pass"), 
            "Count Total", COUNTROWS(Results)
        ), 
        [Count Pass]/[Count Total] >= .5
    )
)

 

This measure will give you a direct count of those people with a Pass/Total of greater than or equal to 50%.  I kept all the parts of the percentage calculation separated to allow you to rearrange and use the pieces as needed.  Usually I would calculate the percentage directly instead of storing them separately in the SUMMARIZE table.

 

 

 

bryanc78 Regular Visitor
Regular Visitor

Re: Dax - count number of people below 50%

Which part to I remove to only show a count?
Super User
Super User

Re: Dax - count number of people below 50%

You should use that entire expression to show a count.  Add that measure into a card or other visual, and it will display a number of people that have a pass rate of over 50%.  

 

 

bryanc78 Regular Visitor
Regular Visitor

Re: Dax - count number of people below 50%

I got it to work. I actually needed those 50% and below so I was updating it to <= .50 but it didn't work. Keeping it your way and just changing the Pass to Fail worked. Thank you

Helpful resources

Announcements
Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

PBI Community Highlights

PBI Community Highlights

Check out what's new in the Power BI Community!

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Kudoed Authors
Users Online
Currently online: 41 members 1,126 guests
Please welcome our newest community members: