Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
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
| ID | Name | cost | Rank |
| 1 | A | 10 | 2 |
| 1 | B | 8 | 1 |
| 2 | A | 5 | 1 |
| 2 | B | 8 | 2 |
| 3 | A | 2 | 1 |
| 3 | B | 4 | 2 |
| 4 | A | 6 | 2 |
| 4 | B | 5 | 1 |
Desired Outcome:
| ID | Name | cost | Rank |
| 1 | B | 8 | 1 |
| 2 | A | 5 | 1 |
| 3 | A | 2 | 1 |
| 4 | B | 5 | 1 |
Appreciate if any help!
Solved! Go to Solution.
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
)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.
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
)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.
@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.
Please explain what you mean by "calculated column cannot be used in a slicer".
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
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])
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 98 | |
| 72 | |
| 50 | |
| 48 | |
| 42 |