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
Anonymous
Not applicable

Divide Ranking Measure by the Max of the Measure

I have a list of clients and an associated "tech rating". I have a "ranking measure" (below) to rank the clients by their tech rating.

 

 

Ranking Measure = 
MINX(
    FILTER(
        SELECTCOLUMNS(
            ALLSELECTED(Table1),
            "Index", Table1[School Systems.Campusname],
            "Rank", RANKX(ALLSELECTED(Table1),Table1[Tech Rating],,DESC,Dense)
        ),
        [Index] = MAX(Table1[School Systems.Campusname])
    ),
    [Rank]
)

This results in the table below.

 

Pic for Help.PNG

 

What I now need is to convert the "Ranking Measure" to a percentage range. In Excel it would be simply: Ranking Measure/Max(Ranking Measure). I have seen this done before, but I'm just having trouble applying it to my situation.

 

Thanks!

1 ACCEPTED SOLUTION

Hi  @Anonymous ,

 

 

We can just add a little change to @SteveCampbell 's formula.

 

 

Ranking % = 
VAR _rnk =
    MINX (
        FILTER (
            SELECTCOLUMNS (
                ALLSELECTED ( 'Table1' ),
                "Index", 'Table1'[name],
                "Rank", RANKX ( ALLSELECTED ( 'Table1' ), 'Table1'[rate],, DESC, SKIP )
            ),
            [Index] = MAX ( 'Table1'[name] )
        ),
        [Rank]
    )
VAR _all =
    CALCULATE ( COUNTROWS ( VALUES ( 'Table1'[name] ) ), ALLSELECTED ( 'Table1' ) )
RETURN
    IF ( _all = 1, 1, DIVIDE ( _rnk - 1, _all - 1) )

 

Here is another formula to achieve the same goal.

 

Ranking % 2 = 
IF (
    COUNTROWS ( ALLSELECTED ( 'Table1' ) ) = 1,
    1,
    DIVIDE (
        RANKX (
            ALLSELECTED ( Table1[name] ),
            CALCULATE ( SUM ( 'Table1'[rate] ) ),
            ,
            DESC,
            SKIP
        ) - 1,
        COUNTROWS ( ALLSELECTED ( 'Table1' ) ) - 1
    )
)

 

18.PNG

 

BTW, pbix as attached.

 

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Community Support Team _ Dong Li
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

8 REPLIES 8
SteveCampbell
Memorable Member
Memorable Member

Could you do:

 

 

Ranking % = 
Divide( [Ranking Measure] , COUNTROWS(VALUES (Table1[School Systems.Campusname])) )

 

 

Appreciate your Kudos
I love to share - connect with me!

Stay up to date on  linkedin-logo.png
Read my blogs on  powerbi.tips_.png



Did I answer your question? Mark my post as a solution! Proud to be a Super User!


Connect with me!
Stay up to date on  
Read my blogs on  



Anonymous
Not applicable

This does not seem to work. I think it's because the client name is not a number?

Sorry, missed a function - I edited the code - try now



Did I answer your question? Mark my post as a solution! Proud to be a Super User!


Connect with me!
Stay up to date on  
Read my blogs on  



Anonymous
Not applicable

This was actually my first idea, but this assums that there are no duplicate "Ranking Measures". There are a few that are duplicate and I don't want the measure to double count. Also, the result is just the mirror of the "Ranking Measure". I think this is because the measure is just dividing the "Ranking Measure" by the count of clients in the row, which is always just 1...

 

Pic for Help2.PNG

Sorry, Try:

 

Ranking % = 
var _rnk = 
MINX(
    FILTER(
        SELECTCOLUMNS(
            ALLSELECTED(Table1),
            "Index", Table1[School Systems.Campusname],
            "Rank", RANKX(ALLSELECTED(Table1),Table1[Tech Rating],,DESC,skip)
        ),
        [Index] = MAX(Table1[School Systems.Campusname])
    ),
    [Rank]
)
return
Divide( _rnk , CALCULATE(COUNTROWS(VALUES (Table1[School Systems.Campusname])),ALLSELECTED(Table1)))

I would change from DENSE to SKIP so the values total to 100, or you can change back depending on your requirements. What would be the desired output if the rank is the same? This would show the same %, which is what the excel solution you described would do

 

 

 

Appreciate your Kudos
I love to share - connect with me!

Stay up to date on  linkedin-logo.png
Read my blogs on  powerbi.tips_.png



Did I answer your question? Mark my post as a solution! Proud to be a Super User!


Connect with me!
Stay up to date on  
Read my blogs on  



Anonymous
Not applicable

At first glance, this seems correct, but I noticed that if I create a slicer and filter out clients, the bottom percentage is no longer 0... is there a way to make it so the distribution is always from 0% to 100%?

Hi  @Anonymous ,

 

 

We can just add a little change to @SteveCampbell 's formula.

 

 

Ranking % = 
VAR _rnk =
    MINX (
        FILTER (
            SELECTCOLUMNS (
                ALLSELECTED ( 'Table1' ),
                "Index", 'Table1'[name],
                "Rank", RANKX ( ALLSELECTED ( 'Table1' ), 'Table1'[rate],, DESC, SKIP )
            ),
            [Index] = MAX ( 'Table1'[name] )
        ),
        [Rank]
    )
VAR _all =
    CALCULATE ( COUNTROWS ( VALUES ( 'Table1'[name] ) ), ALLSELECTED ( 'Table1' ) )
RETURN
    IF ( _all = 1, 1, DIVIDE ( _rnk - 1, _all - 1) )

 

Here is another formula to achieve the same goal.

 

Ranking % 2 = 
IF (
    COUNTROWS ( ALLSELECTED ( 'Table1' ) ) = 1,
    1,
    DIVIDE (
        RANKX (
            ALLSELECTED ( Table1[name] ),
            CALCULATE ( SUM ( 'Table1'[rate] ) ),
            ,
            DESC,
            SKIP
        ) - 1,
        COUNTROWS ( ALLSELECTED ( 'Table1' ) ) - 1
    )
)

 

18.PNG

 

BTW, pbix as attached.

 

Best regards,

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

There we go! Awesome! Thank you so much!

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.