Forum Discussion
Filippomonti
3 years agoFrequent Visitor
Help with rank in DAX
Hi everyone,
so, let's say I have matrix like this table
| Business Unit | Client_Code | Client_Name | Actual |
| BU1 | 111 | Alpha | 10 |
| BU1 | 112 | Beta | 5 |
| BU1 | 113 | Gamma | 30 |
| BU2 | 221 | One | 60 |
| BU2 | 222 | Two | 50 |
| BU2 | 223 | Three | 70 |
| BU3 | 331 | USA | 90 |
| BU3 | 332 | ITA | 52 |
| BU3 | 333 | DEU | 12 |
With some filters, i get this matrix
| Business Unit | Client_Code | Client_Name | Actual |
| BU1 | 111 | Alpha | 10 |
| BU1 | 112 | Beta | 5 |
| BU1 | 113 | Gamma | 30 |
Now, I want to create a measure to rank Client_Code for Actual to display something like this
| Business Unit | Client_Code | Client_Name | Actual | Rank by Client_Code |
| BU1 | 111 | Alpha | 10 | 2 |
| BU1 | 112 | Beta | 5 | 3 |
| BU1 | 113 | Gamma | 30 | 1 |
I tried some solutions found on internet but nothing seems to work, can someone help me please? Thank you in advance!
Have a nice day
Filippo
- Anonymous3 years ago
Hi Filippomonti ,
You can try the following measure:
Measure = RANKX(FILTER(ALLSELECTED('Table'),[Business Unit]=MAX('Table'[Business Unit])),CALCULATE(SUM('Table'[Actual])),,ASC,Dense)Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
1 Reply
- AnonymousNot applicable
Hi Filippomonti ,
You can try the following measure:
Measure = RANKX(FILTER(ALLSELECTED('Table'),[Business Unit]=MAX('Table'[Business Unit])),CALCULATE(SUM('Table'[Actual])),,ASC,Dense)Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.