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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
aleivar
Frequent Visitor

RANKX not working properly when applying filter

Hi,

My RANKX function is not working properly when I apply a Brand filter. For example, without filters I get the following rank

aleivar_0-1682028389215.png

But when I apply a Brand filter, to select only Pure Sunfarms, Redecan, and Good Supply the ranking changes:

aleivar_1-1682028487599.png

 

My formula is:

Rank (Total Sales) Brand = 
IF(
    HASONEVALUE(
        'OCS-daily-2018-2023'[brand]
    ),
    RANKX(
        ALL(
            'OCS-daily-2018-2023'[brand]
        ),
        [Total Sales],
        ,
        DESC,
        Dense
    )
)

 

and my model looks like this:

aleivar_2-1682028598564.png


Any help is greatly appreciated.

2 REPLIES 2
aleivar
Frequent Visitor

Hi, I tried that but it's not working. I want to keep the same rank:
1,2,3 even when applying the brand filter

FreemanZ
Super User
Super User

hi @aleivar 

try to change ALL to ALLSELECTED.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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.