Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I work in a school and am trying to rank students by year (based on a points system for rewards) and then retain that ranking when I use the slicer for which house they are in. This would allow tutors to see their own student's ranking in the year.
From our database, I have a table with school code (the student’s unique number), the points award (many entries per student) and their name.
I then used measures to calculate the total points for each student
Points Total = sumx(vw_PowerBIRandC,vw_PowerBIRandC[Total])
and then ranked these with another measure:
Rank4 = IF (NOT (ISBLANK ( vw_PowerBIRandC[Points Total] ) ), RANKX (FILTER ( ALL ( vw_PowerBIRandC[SchoolCode],vw_PowerBIRandC[Surname]), NOT ( ISBLANK ( vw_PowerBIRandC[Points Total] ) ) ), vw_PowerBIRandC[Points Total]))
– it took a while doing this as some students who had no rewards showed as blanks which were then erroneously ranked.
This ranking measure is recalculated based on which year they are in (using a slicer) but now I want the house slicer to select the subset of students within that house but carry their year ranking through not re-ranking them based on the students position in the house.
Any help would be great!
Solved! Go to Solution.
I'd wrap [Rank4 ] into calculate and add ALL(TableName[HouseName]) to ignore the slicer
e.g. to something like this:
Rank4 =
CALCULATE (
IF (
NOT ( ISBLANK ( vw_PowerBIRandC[Points Total] ) ),
RANKX (
FILTER (
ALL ( vw_PowerBIRandC[SchoolCode], vw_PowerBIRandC[Surname] ),
NOT ( ISBLANK ( vw_PowerBIRandC[Points Total] ) )
),
vw_PowerBIRandC[Points Total]
)
),
ALL ( TableName[HouseName] )
)
I'd wrap [Rank4 ] into calculate and add ALL(TableName[HouseName]) to ignore the slicer
e.g. to something like this:
Rank4 =
CALCULATE (
IF (
NOT ( ISBLANK ( vw_PowerBIRandC[Points Total] ) ),
RANKX (
FILTER (
ALL ( vw_PowerBIRandC[SchoolCode], vw_PowerBIRandC[Surname] ),
NOT ( ISBLANK ( vw_PowerBIRandC[Points Total] ) )
),
vw_PowerBIRandC[Points Total]
)
),
ALL ( TableName[HouseName] )
)
That's brilliant - many thanks.
Just one issue and that is how do i get rid of the extra students appearing under the year rankings?
(see attached)
Got it - just use the visual level filter to remove blanks!
many thanks again.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 41 | |
| 38 | |
| 36 | |
| 31 | |
| 28 |
| User | Count |
|---|---|
| 129 | |
| 88 | |
| 79 | |
| 68 | |
| 63 |