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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
gautampruthi
Helper II
Helper II

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 shownIncorrect values shownCorrect value shown for different slicerCorrect value shown for different slicer



1 ACCEPTED SOLUTION
parry2k
Super User
Super User

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

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @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! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

9 REPLIES 9
parry2k
Super User
Super User

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

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @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! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@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! ❤️



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @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! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hi @parry2k here is the link of the sample pbi file https://drive.google.com/file/d/15ZU27h3LGuNI6QAg1_fdX3PxoZAoISCa/view?usp=sharing 

For some filters applied, it works fine, but for others, it does nott, The Values in Line chart are correct. for example if you select mode as registered it will show rank as 8 in visual (which is filtered to Newman) but in line chart its 7 which is correct

thanks for your time and help.

gautampruthi
Helper II
Helper II

@parry2k I would appreciate your assistance in resolving this issue

parry2k
Super User
Super User

@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.

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @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! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Ashish_Mathur
Super User
Super User

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.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
parry2k
Super User
Super User

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

[Average Positvity Measure (%)]

 

@gautampruthi



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @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! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k this is the expression for measure

Average Positivity % = AVERAGE('TableName'[Positivity Measure])

 

@Ashish_Mathur is there any workaround for this.

 

thanks for the help

Hi,

You may not need a workaround.  @parry2k may have a proper solution.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors