Forum Discussion

Ganapathi's avatar
Ganapathi
Frequent Visitor
10 years ago
Solved

Distinct Rank for each criteria

Hi All,   i would like to create Distinct Rank for each employee code seperately based on score as shown in the below picture. Rank should be distinct. For Instance, if the score is same for two li...
  • Twan's avatar
    10 years ago

    This is difficult since the built in RANKX function does not have an option to handle ties this way.  It would reutrn ties with non distinct numbers and would have similar values to your Actual Rank column.

     

    One way to get around this limitation is to modify the Score data so that all values are unique.  This can be done by adding a very small random number to the score data.  The number would be so small that it would not change the score in any meaningful way but would allow the numbers to be unique so that ties are handled correctly when using the RANX function.

     

    I would add a calculated column called Score Random:

    Score Random = (RAND()*0.000001) + 'Table'[Score]

    Then add a column that ranks based on the Score Random column:

    Rank = RANKX(FILTER('Table', 'Table'[Employee Code] = EARLIER('Table'[Employee Code])), 'Table'[Score Rand],,DESC,Skip)

     

    I ended up with this table as a result: