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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.