Forum Discussion

natti_plis's avatar
natti_plis
Frequent Visitor
2 years ago
Solved

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

 

 

I would be super grateful for the help!

 

Thanks

Natalia 

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

2 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    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)
  • natti_plis's avatar
    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