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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply

ranking and TOpN

Hi All,

Need some help.

 

I have these two measures.

 

Item Ranking by Total Cost (Selected Range) = 

IF( ISBLANK( [Total Cost] ),

BLANK (),

RANKX (

ALLSELECTED( 'Item'),

[Total Cost],

,

DESC,

Skip

)

)

 

 

Top Item Total Cost by Rank = 

VAR

RankingDimension = VALUES( 'Item'[Item Name] )

VAR

RankingSelect = 'Ranking Selections'[Ranking Select]

RETURN

IF( ISBLANK([Total Cost]),

BLANK(),

CALCULATE( [Total Cost],

FILTER( RankingDimension,

RANKX( ALL('Item'[Item Name]), [Total Cost], ,Desc, SKIp) <= RankingSelect ) )

)

 If these measures are used seperately, they are working correctly.

However when include my ranking measure with TOPN Measure. Below is what I get.

 

nadeemrajabali_0-1633559530716.png

Can someone please help me fix the second Matrix?

1) Only selected TOP N are displayed

2) the Ranking is not working correctly, there are some ranks repeated twice however the Totalcost is not exactly same.

 

Third Question that is a tricky one. Is there a way I can create a Dynamic dropdown slicer from second matrix that shows me the list formatted as below?

Rank | Item Name | Total Cost

 

Thanks

 

 

 

 

1 REPLY 1
Greg_Deckler
Community Champion
Community Champion

@nadeemrajabali Seems like you need a Complex Selector: The Complex Selector - Microsoft Power BI Community

 

RANKX can be tricky to work with, particularly as a measure: To *Bleep* with RANKX! - Microsoft Power BI Community

 

There's a good chance you need a CALCULATE.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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.