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

Difference between RANKX in Matrix and Card visuals

Hello,

I've reached out to two experts on this, and neither has been able to figure this one out.

 

I have a basic RANKX formula, ranking Sales:

Rank Sales =
RANKX ALL'aims teams' ), [SUM.$CFLV Sales] )
 
Within a Matrix visual, it is performing exactly how you would expect:
Picture1.png
However, when I create a Card visual and filter to a particular row, it can sometimes return the wrong result:
Picture3.pngPicture4.png
But, some rows return the right result:
 
Picture5.pngPicture6.png
What's going on here?
1 ACCEPTED SOLUTION

Hi, @TMoney 

I'm sorry for replying so late, I've just seen your message.

Please checked the attached pbix file. You may need to modify the measure formula like:

New Rank Basic = 
VAR tab =
    ADDCOLUMNS (
        ALLEXCEPT('aims teams','aims teams'[Index]),
        "SUM.$Sales", [SUM.$Sales],
        "_Rank basic", [Rank basic]
    )

RETURN
    MINX(tab, [_Rank basic] )

veasonfmsft_0-1668479259211.png

 

Best Regards,
Community Support Team _ Eason

 

 

View solution in original post

11 REPLIES 11
Anonymous
Not applicable

Hi, 

 

I tried using this formula above but I am getting the rank to show as 1 for everything. This is because it is calculating the minimum value of the rank column which is 1. Any ideas on how to solve this?

Kansetsuwaza
Frequent Visitor

Have you managed to solve this issue becasue I have the same problem and could not find a solution.

Yes.  See the solution below.  

Tried to apply your query in my visual but did not work.

Basically, I am trying to do a hotel benchmark analysis in terms of their occupancy rates. 
As you see below, the MATRIX rank and CARD rank are not matching. 
I have 2 slicers that show hotel names and locations. In some cases, I would like to increase my sample size by choosing more than one location (it's A+B locations in my below sample ) but the rank level seems incorrect when I chose multiple locations.

I chose Hotel 2, It's rank should be 2 under location A and 3 under location A+B but CARD shows the rank as 2 for both situations.

Rank Occ = IF(HASONEVALUE('Survey Data'[Hotel Name]),RANKX(ALL('Survey Data'[Hotel Name]),[Occupancy Rate (%)]))
rankx new = RANKX(CROSSJOIN(ALL('Survey Data'[Hotel Name]),ALLSELECTED('Survey Data'[Location])),[Occupancy Rate (%)])

Kansetsuwaza_0-1669213065580.png

 

v-easonf-msft
Community Support
Community Support

Hi, @TMoney 

It might be related to the formula of [SUM.$CFLV Sales].
Please provide a sample pbix for further research.

 

Best Regards,
Community Support Team _ Eason

Hi, @TMoney 

Add a new measure like:

New Rank basic =
VAR tab =
    ADDCOLUMNS (
        'aims teams',
        "SUM.$Sales", [SUM.$Sales],
        "_Rank basic", [Rank basic]
    )
RETURN
    MINX ( tab, [_Rank basic] )

veasonfmsft_0-1668063837645.png

 

Best Regards,
Community Support Team _ Eason

Thanks for the response.  Your [New Rank Basic] measure makes sense (albeit I'm still confused as to why it's a necessary layer on top of RANKX).  In any event, it's still not working in my "real" file (I had redacted some info for purposes of posting the sample, but nothing that would seemingly impact results):

Picture4.png

RANKX card not same as RANKX matrix - updated 

TMoney
Frequent Visitor

I was awaiting a further response to my question (sample file was attached which is still showing the error).  On top of trying to solve this particular challenge, I'm really interested in the underlying cause of why RANKX is behaving in this extremely unpredictable and strange way.

Hi, @TMoney 

I'm sorry for replying so late, I've just seen your message.

Please checked the attached pbix file. You may need to modify the measure formula like:

New Rank Basic = 
VAR tab =
    ADDCOLUMNS (
        ALLEXCEPT('aims teams','aims teams'[Index]),
        "SUM.$Sales", [SUM.$Sales],
        "_Rank basic", [Rank basic]
    )

RETURN
    MINX(tab, [_Rank basic] )

veasonfmsft_0-1668479259211.png

 

Best Regards,
Community Support Team _ Eason

 

 

Anonymous
Not applicable

Hi! I'm having the same problem as the original poster but, when I try this measure in a visual, it keeps loading forever. Do you might know what can be causing this?

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.