Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi,
Could you please help me with a measure that can rank the zero values based on another column.
Sample dataset:
Student Name | Attendence (%) | Total Mark | Expected Ranking |
Ian | 70 | 50 | 1 |
Becky | 75 | 48 | 2 |
Cathy | 80 | 38 | 3 |
John | 50 | 38 | 4 |
Denny | 60 | 20 | 5 |
Kin | 65 | 10 | 6 |
Lena | 63 | 7 | 7 |
Mark | 72 | 3 | 8 |
Ean | 90 | 0 | 9 |
Nora | 80 | 0 | 10 |
Fahl | 70 | 0 | 11 |
The column "Expected Ranking" is the outcome of a measure that ranks the students based on the "Total Mark" column. But when it comes to the zero marks it should rank based on the "Attendance(%)" column.
To summarize, whenever there is a tie in marks, it should consider the Attendance column and rank accordingly.
(Row 3 and 4 are tie and it ranked based on Attendance column)
Any help on this appreciated.
Thank you.
Solved! Go to Solution.
Ranking =
VAR _mark = [Total Mark]
RETURN
COUNTROWS (
FILTER (
ALLSELECTED ( Table[Student Name] ),
[Total Mark] >= _mark
&& IF (
[Total Mark] = _mark,
'Table'[Student Name] <= MAX ( 'Table'[Student Name] ),
TRUE ()
)
)
)
Ranking =
VAR _mark = [Total Mark]
RETURN
COUNTROWS (
FILTER (
ALLSELECTED ( Table[Student Name] ),
[Total Mark] >= _mark
&& IF (
[Total Mark] = _mark,
'Table'[Student Name] <= MAX ( 'Table'[Student Name] ),
TRUE ()
)
)
)
Thanks for the reply.
Is [Total Mark] a measure that is the sum of the Total Marks column?
it's a measure
=SUM(Table[Mark])
Thank you. That seems to work!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
16 | |
13 | |
12 | |
11 | |
11 |
User | Count |
---|---|
19 | |
14 | |
14 | |
11 | |
9 |