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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
LuisCP2012
Helper I
Helper I

RANKX not showing top 1 rank value in card

I'm doing 2 measures, one that shows business ranking by the amount of money (RANK) which is displaying properly and my TOP rank that is suppose to show the number 1 from my RANK measure, in this case it should be "SUPERMERCADO SANTILLAN", but is showing "BOTICA CUIDAMOS" for some reason.

The table I'm using is "HIST_DOC"

Here is my RANK code:

 

 

RANK = RANKX(ALLSELECTED(HIST_DOC[NOM_EMP]), CALCULATE(SUM(HIST_DOC[MON_TOT])), , DESC)

 

 

Here is my TOP code:

 

 

TOP = CALCULATE(FIRSTNONBLANK(VALUES(HIST_DOC[NOM_EMP]),1) , FILTER(HIST_DOC, [RANK] = 1))

 

 

Here is a picture for a better understanding

 

TOP VALUE.PNG 

2 REPLIES 2
lbendlin
Super User
Super User

Try this version

 

TOP = 
var RNK = RANKX(ALLSELECTED(HIST_DOC[NOM_EMP]), CALCULATE(SUM(HIST_DOC[MON_TOT])), , DESC)
return CALCULATE(FIRSTNONBLANK(VALUES(HIST_DOC[NOM_EMP]),1) , FILTER(ALLSELECTED(HIST_DOC), RNK = 1))

It's still showing "BOTICA CUIDAMOS" but it's right next to the rank 1 row

TOP VALUE2.PNG

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

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.