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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply

Group by Percentage Range

Hello All,

 

I am trying to get a count of percentages within a range, most likely using DAX. See sample below:

Data:

Inspection Score:
85%
85%
90%
70%
75%
100%
92%
75%

 

Output Goal:

Scores less than 70%: 0

Scores between 70-79.99%: 3

Scores between 80-89.99%: 2

Scores between 90-99.99%: 2

Scores above 99.99%: 1

 

Any assistance would be greatly appreciated.

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @datadmin-austin 

try to create a bunch of measures like:

Scores less than 70% = 
COUNTROWS(
    FILTER(
        TableName,
        TableName[Score]<0.7
    )
)

Scores between 70-79.99% = 
COUNTROWS(
    FILTER(
        TableName,
        TableName[Score]>=0.7
            &&TableName[Score]<=0.799
    )
)

Scores between 80-89.99% = 
COUNTROWS(
    FILTER(
        TableName,
        TableName[Score]>=0.8
            &&TableName[Score]<=0.8999
    )
)

Scores between 90-99.99% = 
COUNTROWS(
    FILTER(
        TableName,
        TableName[Score]>=0.9
            &&TableName[Score]<=0.9999
    )
)

Scores abvoe 99.99% = 
COUNTROWS(
    FILTER(
        TableName,
        TableName[Score]>0.9999
    )
)

 

verified with the multi-row card visual and worked like this:

FreemanZ_0-1675237698305.png

 

View solution in original post

4 REPLIES 4
FreemanZ
Super User
Super User

hi @datadmin-austin 

try to create a bunch of measures like:

Scores less than 70% = 
COUNTROWS(
    FILTER(
        TableName,
        TableName[Score]<0.7
    )
)

Scores between 70-79.99% = 
COUNTROWS(
    FILTER(
        TableName,
        TableName[Score]>=0.7
            &&TableName[Score]<=0.799
    )
)

Scores between 80-89.99% = 
COUNTROWS(
    FILTER(
        TableName,
        TableName[Score]>=0.8
            &&TableName[Score]<=0.8999
    )
)

Scores between 90-99.99% = 
COUNTROWS(
    FILTER(
        TableName,
        TableName[Score]>=0.9
            &&TableName[Score]<=0.9999
    )
)

Scores abvoe 99.99% = 
COUNTROWS(
    FILTER(
        TableName,
        TableName[Score]>0.9999
    )
)

 

verified with the multi-row card visual and worked like this:

FreemanZ_0-1675237698305.png

 

@FreemanZ Thank you very much! This is much more simple and managable.

amitchandak
Super User
Super User

@datadmin-austin , I think you need

 

Dynamic Segmentation Bucketing Binning
https://community.powerbi.com/t5/Quick-Measures-Gallery/Dynamic-Segmentation-Bucketing-Binning/m-p/1...


Dynamic Segmentation, Bucketing or Binning: https://youtu.be/CuczXPj0N-k

@amitchandak Thank you for your message. I had to use the steps below to complete this:

 

  1. Create a measured column: 

 

Percentage Ranking = 
SWITCH(
    TRUE(),
    [InspectionScore] < .7000, "Very Poor",
    [InspectionScore] < .8000, "Poor",
    [InspectionScore] < .9000, "Good",
    [InspectionScore] < .9999, "Very Good",
    "Perfect"
)​

 

  • Create a measure:

 

Score(70-80%) = 
CALCULATE(
    COUNT('Inspection Data'[Percentage Ranking]),
    FILTER('Inspection Data',
        'Inspection Data'[Percentage Ranking] = "Poor"
    )
)

 

I believe this should work. I was hoping to find a measure that did not require a measured column, is that possible?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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