Forum Discussion

ViralPatel212's avatar
ViralPatel212
Icon for Resolver I rankResolver I
2 years ago
Solved

Ranking Error - showing 1

Wondering if you could help. 

Second post but getting no help?

 

I am trying to create a simple summarized table where it shows where Barclays sits for each category.

 

in my main table the ranking works using this formula. I have filtered the category to NNIP and it shows that Barclays is ranked 6 based of Vol. (MM).

Ranking: IF[Ranking Size (Vol)] = blank(), BLANK(), RANKX(ALLSELECTED('Dealer Ranking'[Counter Party]),[Ranking Size (Vol)],,DESC))

 

 

However when i table showing jus category and the rank it doesn't work.

In this on the allselected didnt work so i tried:  

Dealer Ranking 4 = RANKX(ALL('Dealer Ranking'[Counter Party]),[Ranking Size (Vol)],,DESC

 

 

as you can see i have put a visual filter to show Barclays but im getting 7 rather than 6?

Hope this make sense.

 

thanks

viral

 

  • Was able to resolve this: 

    Measure: 
    var _rank = RANKX(ALL('Dealer Ranking'[Counter Party]),[Ranking Size (Vol)],,DESC)
    VAR _tab =
        FILTER (
            ADDCOLUMNS (
                ALL( 'Dealer Ranking'[Counter Party] ),
                "@rank", [Dealer Ranking Number 2 test]
            ),
            [Counter Party] = "Barclays"
        )
    VAR _rankbarclays =
        MAXX ( _tab, [@rank] )
    
    
    RETURN
    
    _rankbarclays

11 Replies

  • MNedix's avatar
    MNedix
    Icon for Solution Sage rankSolution Sage

    TBH, I can't see anything in those screenshots, they are too small.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi ViralPatel212 ,

     

    Thanks for the reply MNedix , I have some suggestions here, I hope they can be helpful to you.


    The ALL function ignores any incoming filter, whether the filter is from the same visual or external. However, the ALLSelected function only ignores filters from the same visual and accepts filters from outside. When you apply a visual filter to only show Barclays, it is important to ensure that the ranking calculation still takes into account the background of other brokers to accurately reflect Barclays' position among those brokers. If the filter context is not passed to the function correctly, it may calculate the ranking in a different context, leading to unexpected results. For more details, please refer to the link: Power BI DAX: ALL vs. ALLSelected - RADACAD.

     

    If your Current Period does not refer to this, please clarify in a follow-up reply.

     

    Best Regards,

    Clara Gong

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • ViralPatel212's avatar
      ViralPatel212
      Icon for Resolver I rankResolver I

      Hi Anonymous 

       

      Thanks for the informative answer. I was struggling to understand the difference between All and AllSelected but its does make sense.

       

      The current period in the example, i don't think it impacts on the results, however if i replaced the all function to Allselected function i am getting a the Value as 1? 

      Do i need to add the Client column into the measure?

       

      I am not sure why i am doing wrong here

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi ViralPatel212 ,

         

        I see multiple slicers in your screenshot, and I don't know the relationship between your tables, so I can't determine what affects the calculation results of measure. You use the allselected function and the result is displayed as 1, most likely due to the effect of the external filter.

         

        If you can provide more details, I can better help you solve your problem.

         

        Best Regards,

        Clara Gong

        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.