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
natti_plis
Frequent Visitor

How to exclude rows from the dynamic RANX metric?

Hi!

I need help with the RANKX function. I have one ranking on the fly, that works perfectly on the items that are selected ->>

duel_rank =
    RANKX(ALLSELECTED(smb_pbi_input[Identifier]), CALCULATE( sum (smb_pbi_input[xxx])), ,ASC)
 

Among the items, I have my_item and competitor items. There is a column prod_type where 1 -> my_item and 2 -> competitor's. 

The idea of the report is that only one my_prod will be always selected and 4 more are competitors of a user's choice. 

 

I need to create another rank (based on another metric) on the fly to make a ranking among selected competitor's items only. 

What I managed to do is a rank that hides the value for my_product but counts it to the RANX anyway. I feel like I tried all the solutions with filters etc. but nothing works. 

 

I even found a ticket with the same problem as mine, but the solution was given in the file that is no longer available. Here's the link to the solution. 

https://community.fabric.microsoft.com/t5/Desktop/Dax-Exclude-a-row-from-RANKX/m-p/2693735#M942805

 

natti_plis_1-1715955457765.png

 

I would be super grateful for the help!

 

Thanks

Natalia 

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@natti_plis Can you provide a link to a sample file. This seems very doable.

duel_rank =
    RANKX(FILTER(ALLSELECTED(smb_pbi_input[Identifier]), [prod_type] = 2), CALCULATE( sum (smb_pbi_input[xxx])), ,ASC)


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
natti_plis
Frequent Visitor

Hi @Greg_Deckler 

You're my hero of the day ❤️

It's working perfectly and looks so simple! I've tried doing something similar in many ways, but I had to miss a detail or use the wrong order of functions. After looking the whole day at this report I had reached a dead end. 

 

Thank you so much, and have a great weekend!

Natalia 

Greg_Deckler
Community Champion
Community Champion

@natti_plis Can you provide a link to a sample file. This seems very doable.

duel_rank =
    RANKX(FILTER(ALLSELECTED(smb_pbi_input[Identifier]), [prod_type] = 2), CALCULATE( sum (smb_pbi_input[xxx])), ,ASC)


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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.