Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
IHam
Helper III
Helper III

Ignore slicer in ranking measure

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!

 

pic1.pngpic2.png

1 ACCEPTED SOLUTION
Stachu
Community Champion
Community Champion

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] )
)


Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

View solution in original post

3 REPLIES 3
Stachu
Community Champion
Community Champion

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] )
)


Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

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)pic3.png

Got it - just use the visual level filter to remove blanks!

many thanks again.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.