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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
alaztor45
Frequent Visitor

Ranking doesn't work with filters

Hello there,

 

I have a matrix in which i rank categories by their sell out. The bigger the sell out the first it comes in the ranking.

 

The thing is, everytime i apply a filter to see the ranking of a specific category, the rank measure just breaks and shows everything as 1. Let me show you my matrix:

 

STORECATEGORIESSell OutRank 
STORE ACATEGORY 5118994.091
STORE ACATEGORY 2100405.012
STORE ACATEGORY 487003.143
STORE ACATEGORY 862858.894
STORE BCATEGORY 587139.971
STORE BCATEGORY 258063.212
STORE BCATEGORY 450141.533
STORE BCATEGORY 847140.744

 

And this is what happens when i apply a filter to let's say....category 8:

 

STORECATEGORIESSell OutRank 
STORE ACATEGORY 862858.891
STORE BCATEGORY 847140.741

 

Btw, this is my ranking formula:

 

 

Sell out rank = 

IF (
    ISINSCOPE( BASE[CATEGORY] ),
    RANKX (
        CALCULATETABLE (
            VALUES ( BASE[CATEGORY]),
            ALLSELECTED ( BASE[CATEGORY])
        ),
        [Sell out]
    )
)

 

 

Any help would be greatly appreciated.

5 REPLIES 5
OliT
Resolver I
Resolver I

Hi @alaztor45 

You can try this measure

test_rank = RANKX(ALLSELECTED(BASE),[Sell Out],,DESC)

OliT_0-1660033605572.png

OliT_1-1660033616474.png


Regards,

OliT

Hi there,

 

Unfortunately when i apply your measure, all categories get a ranking without taking into consideration the store which they belong to. 

lbendlin
Super User
Super User

What is your expected result?  If you filter by category, do you want to see the store rank instead?

Yes that's the goal. If i filter by category 8 i want the same rank that i would get when all of the categories are ranked.

 

Is that possible with a measure?

Either use a calculated column for the rank, or create a new measure that expands the filter context accordingly (remove filters for category but keep filters for store)

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors