Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

undefined

Hi all, I have a table like this 

I want to assign ranks on the score based on score, i.e highest score will have rank 1 and 2nd highest will be rank 2 and so on.if the scores are tied, then same rank for both! How can I achieve this? 

  • Hi Anonymous ,

     

    Please try the measure.

     

    Rank = 
    RANKX (
        ALLSELECTED ( 'Table'[ID] ),
        CALCULATE ( SUM ( 'Table'[Score] ) ),
        ,
        DESC,
        DENSE
    )

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
    Best Regards,
    Winniz
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Like this

    'Product'[UnitPriceRankDense] =
    VAR PriceOfCurrentProduct = 'Product'[Unit Price]
    VAR HigherPrices =
    FILTER (
    VALUES ( 'Product'[Unit Price] ),
    'Product'[Unit Price] > PriceOfCurrentProduct
    )
    RETURN
    COUNTROWS ( HigherPrices ) + 1
     (From <The Definitive Guide to DAX> P96)

  • v-kkf-msft's avatar
    v-kkf-msft
    Community Support

    Hi Anonymous ,

     

    Please try the measure.

     

    Rank = 
    RANKX (
        ALLSELECTED ( 'Table'[ID] ),
        CALCULATE ( SUM ( 'Table'[Score] ) ),
        ,
        DESC,
        DENSE
    )

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
    Best Regards,
    Winniz
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.