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.
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_Name | Student_ID | Average_scores | Rank |
Group 1 | 100 | 3.93 | 1 |
Group 1 | 119 | 3.96 | 2 |
Group 1 | 102 | 4.01 | 3 |
Group 1 | 101 | 4.13 | 4 |
Group 1 | 114 | 4.38 | 5 |
Group 2 | 106 | 3.75 | 1 |
Group 2 | 104 | 3.85 | 2 |
Group 2 | 117 | 3.94 | 3 |
Group 2 | 115 | 3.95 | 4 |
Group 2 | 103 | 3.96 | 5 |
Group 2 | 105 | 4.36 | 6 |
Group 3 | 116 | 3.87 | 1 |
Group 3 | 120 | 3.90 | 2 |
Group 3 | 107 | 3.96 | 3 |
Group 3 | 108 | 3.97 | 4 |
Group 3 | 109 | 3.97 | 4 |
Group 4 | 118 | 3.78 | 1 |
Group 4 | 112 | 3.90 | 2 |
Group 4 | 110 | 3.94 | 3 |
Group 4 | 111 | 4.05 | 4 |
Group 4 | 113 | 4.08 | 5 |
Solved! Go to Solution.
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!
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 )
i am unable to select, getting red underline
= EARLIER ( Example_Rank[Group_Name] )
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
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!
I'm sorry for necroing this thread but when I try the proposed solution I get the error "EARLIER/EARLIEST refers to an earlier row contect which doesn't exist."
What creates the previous row context in your case but not mine? I have a plain table I try to rank by a grouping just the same way as in the example.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
97 | |
80 | |
69 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |