Forum Discussion

gautampruthi's avatar
gautampruthi
Icon for Helper II rankHelper II
3 years ago
Solved

Rankx showing wrong values in card visual

Hi,

I have used rankx to calculate rank but it is showing incorrect values for some of the filter values.

 

Currently, I have selected the provider name as Newman in the card and used the following code to calculate the rank

 

 

Rank = RANKX(ALL('All subjects'[provider name]), [Average Positvity Measure (%)], , DESC)

 

 

 

 

Incorrect values shownCorrect value shown for different slicer



  • gautampruthi thanks for sharing the pbix file, for now use this measure using new RANK function, when I get a chance I will explain why RANKX is not working:

     

    Rank = 
    RANK (
        DENSE,
        ALL ( 'All subjects'[Provider name] ),
        ORDERBY ( [Average Positvity Measure (%)], DESC )
    )

     

9 Replies

  • very hard to tell what is going on? What is the expression for this measure? 

    [Average Positvity Measure (%)]

     

    gautampruthi

  • Hi,

    I don't think you will get any meaningful result of a RANKX() measure in a card visual simply because there is no row context in a card visual.  I could be wrong on this but having tried to solve a similar problem, i have always spectacularly failed.

  • Ashish_Mathur I don't think that is the case here because the RANK measure is using the ALL function, either there is something to do with the data model or something to do with the measure used in the RANK.

     

     

  • gautampruthi can you share pbix file? Remove sensitive information before sharing, you can share using one drive/google drive.

     

    👉 Learn Power BI and Fabric - subscribe to our YT channel - @PowerBIHowTo

    If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤️

  • gautampruthi thanks for sharing the pbix file, for now use this measure using new RANK function, when I get a chance I will explain why RANKX is not working:

     

    Rank = 
    RANK (
        DENSE,
        ALL ( 'All subjects'[Provider name] ),
        ORDERBY ( [Average Positvity Measure (%)], DESC )
    )