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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
logan_logan
Helper I
Helper I

show rank in cards (without any row)

Hi I want to show rank in cards.

Like 

Category     SALES

A                  22

B                  29

C                  50               

D                  60

 

So when I select category C, then in the card I should see '2' as the rank on sales is the second.

I treid this DAX that works in table/matrix but not on Cards.

Rank_LM = RANKX(ALL('table'[Categoy]),sum(SALES),,DESC)
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @logan_logan ,

Please try to create a measure with below dax formula:

Measure2 =
VAR _rk =
    RANKX ( ALL ( 'Table' ), CALCULATE ( MAX ( 'Table'[SALES] ) ),, DESC, DENSE )
VAR _result =
    IF ( ISFILTERED ( 'Table'[Category] ), _rk, BLANK () )
RETURN
    _result

Animation27.gif

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @logan_logan ,

Please try to create a measure with below dax formula:

Measure2 =
VAR _rk =
    RANKX ( ALL ( 'Table' ), CALCULATE ( MAX ( 'Table'[SALES] ) ),, DESC, DENSE )
VAR _result =
    IF ( ISFILTERED ( 'Table'[Category] ), _rk, BLANK () )
RETURN
    _result

Animation27.gif

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I had to tweak a lillte bit as I had two categories but **bleep** worked. Thanks.

DallasBaba
Skilled Sharer
Skilled Sharer

@logan_logan you can reshape with a CALCULATE function:

 

Rank_LM_Category2 =
RANKX(
FILTER('table', 'table'[Category] = "Category 2"),
CALCULATE(SUM('table'[Sales]), ALL('table'[Category])),
,
DESC
)

 

Let me know if this works

Thanks

Thanks
Dallas
logan_logan
Helper I
Helper I

Hi,

Actually I will filter another category(lets say caterogy 2) and then I need the rank on category (A,B,C,D). 

So can you please reshape your dax?

DallasBaba
Skilled Sharer
Skilled Sharer

@logan_logan let try FILTER constent to your meassure for the table to include only the rows where the Category matches the selected category in your card.

 

Rank_LM =
RANKX(
FILTER('table', 'table'[Category] = SELECTEDVALUE('table'[Category])),
SUM('table'[Sales]),
,
DESC
)

 

Let me know if this works

Thanks

Thanks
Dallas

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 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.