Forum Discussion

ontario234's avatar
ontario234
Helper I
8 years ago
Solved

RANKX with groups

Need some regarding the Rankx function. I need to assign ranks to the candidates on their average scores grouped by their group_Name. I tried the following and recieveing an error:

 

Rank = rankx(allexcept(Example_Rank,Example_Rank[Group_Name]),Example_Rank[Average_scores])

ERROR: A circular dependency was detected: Example_Rank[Rank].

 

The following is the output with field "RANK"  I am looking for:

 

Group_NameStudent_IDAverage_scoresRank
Group 11003.931
Group 11193.962
Group 11024.013
Group 11014.134
Group 11144.385
Group 21063.751
Group 21043.852
Group 21173.943
Group 21153.954
Group 21033.965
Group 21054.366
Group 31163.871
Group 31203.902
Group 31073.963
Group 31083.974
Group 31093.974
Group 41183.781
Group 41123.902
Group 41103.943
Group 41114.054
Group 41134.085
  • ontario234's avatar
    ontario234
    8 years ago

    Sorry! My bad! Its working the way it should..the problem was fixed by fixing the decimal points of average grades to 2 digits..Thank you so much again!

5 Replies

  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    Community Champion

    Hi ontario234

     

    Try this instead

     

    RANK =
    RANKX (
        FILTER (
            Example_Rank,
            Example_Rank[Group_Name] = EARLIER ( Example_Rank[Group_Name] )
        ),
        Example_Rank[Average_scores],
        ,
        ASC,
        DENSE
    )
    • ontario234's avatar
      ontario234
      Helper I

      Thank you Zubair. It worked however, i need to assign same rank when the average scores are same. For example; if there are two canidates with a score of 4.15, both of them should be assigned same rank instead of 2 consecutive ranks. Any suggestions on how to achieve that? Thanks

      • ontario234's avatar
        ontario234
        Helper I

        Sorry! My bad! Its working the way it should..the problem was fixed by fixing the decimal points of average grades to 2 digits..Thank you so much again!

    • spartanboy's avatar
      spartanboy
      Helper II

      i am unable to select, getting red underline

      = EARLIER ( Example_Rank[Group_Name] )