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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
ngct1112
Post Patron
Post Patron

Measure - How to Rank a column by items

Hi all,

I am trying to summarize a table by ranking the cost.

Desired outcome:

-Only rank with the same "ID"

-The summarize table which only contains "Rank 1" or "Rank 2"

 

Here is what I am trying but NOT success:

 

 

 

Rank=RANKX(Filter(ALLSELECTED('Table'),'Table'[ID]='Table'[ID],CALCULATE(SUM('Table'[Cost])))

 

 

 

From

IDNamecostRank
1A102
1B81
2A51
2B82
3A21
3B42
4A62
4B51

 

Desired Outcome:

IDNamecostRank
1B81
2A51
3A21
4B51

 

Appreciate if any help!

1 ACCEPTED SOLUTION
v-janeyg-msft
Community Support
Community Support

Hi, @ngct1112 

 

It’s my pleasure to answer for you.

According to your description,I think you can create a measure, then use it in filter pane.

Like this:

Rank =
RANKX (
    FILTER ( ALL ( 'Table' ), 'Table'[ID] = SELECTEDVALUE ( 'Table'[ID] ) ),
    CALCULATE ( SUM ( 'Table'[Cost] ) ),
    ,
    1
)

11.png

If it doesn’t solve your problem, please feel free to ask me.

 

Best Regards

Janey Guo

 

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

6 REPLIES 6
ngct1112
Post Patron
Post Patron

@v-janeyg-msft it works. Great thanks with your help.

v-janeyg-msft
Community Support
Community Support

Hi, @ngct1112 

 

It’s my pleasure to answer for you.

According to your description,I think you can create a measure, then use it in filter pane.

Like this:

Rank =
RANKX (
    FILTER ( ALL ( 'Table' ), 'Table'[ID] = SELECTEDVALUE ( 'Table'[ID] ) ),
    CALCULATE ( SUM ( 'Table'[Cost] ) ),
    ,
    1
)

11.png

If it doesn’t solve your problem, please feel free to ask me.

 

Best Regards

Janey Guo

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

ngct1112
Post Patron
Post Patron

@lbendlin I am trying to put a slicer for column "Name", and the ultimate is to find out the ranking for selected value of this Slicer.
If calculated in "Add column", the result will not be ranked for the designated filtered items.

lbendlin
Super User
Super User

Please explain what you mean by "calculated column cannot be used in a slicer".

ngct1112
Post Patron
Post Patron

Thanks @lbendlin , However, the calculated column cannot be apply to the Slicer.
Is there any way you could think of for the measure? Great thanks with your help anyways

lbendlin
Super User
Super User

Here is a version that uses a Calculated Column  (not a Measure!)

 

Rank = 
var tid = 'Table'[ID]
return Rankx(filter('Table','Table'[ID]=tid),'Table'[cost])

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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 Kudoed Authors