Forum Discussion
maurcoll
2 years agoHelper IV
Rank with custom sort
Good Morning, I need some help please with the RankX function.
I have the following table the rank number is being created via a measure:
Store Rank =
RANKX ( ALLSELECTED(Table[Store] ),
[Total Sales] )
which works and when i select 2 or 3 stores the ranking amends according which is what i want it to do.
What i need to do is change the sort order in the ranking from lowest to highest so the lowest sales would be Ranked as 1 and so on.
| Sales | Rank | Store |
| 21143.488 | 1 | E |
| 3841.609 | 2 | F |
| 3459.439 | 3 | O |
| 2949.797 | 4 | K |
| 2848.598 | 5 | P |
| 2679.739 | 6 | M |
| 2467.59 | 7 | D |
| 2396.175 | 8 | A |
| 2380.292 | 9 | H |
| 2285.874 | 10 | C |
| 2247.682 | 11 | G |
| 2238.729 | 12 | L |
| 2235.94 | 13 | B |
| 2181.591 | 14 | N |
| 2031.125 | 15 | J |
| 1744.796 | 16 | I |
I worked it out as
Store Rank =RANKX ( ALLSELECTED(Table[Store] ),[Total Sales] , , asc, dense)and this seems to be working