Forum Discussion
Anonymous
7 years agoNot applicable
need help with Ranking in DAX
Below is my data
| Person | Price | Calls | Measure - Price/Calls |
| Tom | 6319.85 | 102 | 61.95931373 |
| Harry | 3345.9 | 59 | 56.71016949 |
| Gina | 7678.55 | 137 | 56.04781022 |
| George | 10882.35 | 208 | 52.31899038 |
| Arnold | 9239.55 | 197 | 46.90126904 |
| Frank | 8605.6 | 184 | 46.76956522 |
| Peter | 9338.8 | 206 | 45.33398058 |
Below is my code for ranking
RANKX (ALLSELECTED(Table ), CALCULATE(SUMX(Table,Table[Measure - Price/Calls])))
and I keep getting everything as Rank 1.
| Person | Price | Calls | Measure - Price/Calls | Rank |
| Tom | 6319.85 | 102 | 61.95931373 | 1 |
| Harry | 3345.9 | 59 | 56.71016949 | 1 |
| Gina | 7678.55 | 137 | 56.04781022 | 1 |
| George | 10882.35 | 208 | 52.31899038 | 1 |
| Arnold | 9239.55 | 197 | 46.90126904 | 1 |
| Frank | 8605.6 | 184 | 46.76956522 | 1 |
| Peter | 9338.8 | 206 | 45.33398058 | 1 |
Below is what I am looking for
| Person | Price | Calls | Measure - Price/Calls | Rank |
| Tom | 6319.85 | 102 | 61.95931373 | 1 |
| Harry | 3345.9 | 59 | 56.71016949 | 2 |
| Gina | 7678.55 | 137 | 56.04781022 | 3 |
| George | 10882.35 | 208 | 52.31899038 | 4 |
| Arnold | 9239.55 | 197 | 46.90126904 | 5 |
| Frank | 8605.6 | 184 | 46.76956522 | 6 |
| Peter | 9338.8 | 206 | 45.33398058 | 7 |
Please help.
- Anonymous7 years ago
Oh, I thought it was just a table and each person had one piece of data.
You may try the followings:
RANKX( ALLSELECTED( Table), CALCULATE( [Price divided by Calls], ALLEXCEPT( Table, Table[Person])), ,
DESC,
Dense)
4 Replies
- AnonymousNot applicable
Hi,
May I know why you use SUMX in your expression? I think it can be as simple as below:
RANKX( Table, Table[Measure - Price/Calls])
- AnonymousNot applicable
Below is a snapshot of the data that i am working with and with your code for Rank i get below.
Not sure what am i missing here.
- AnonymousNot applicable
Oh, I thought it was just a table and each person had one piece of data.
You may try the followings:
RANKX( ALLSELECTED( Table), CALCULATE( [Price divided by Calls], ALLEXCEPT( Table, Table[Person])), ,
DESC,
Dense)