Forum Discussion

maurcoll's avatar
maurcoll
Helper IV
2 years ago
Solved

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.
 
SalesRankStore
21143.4881E
3841.6092F
3459.4393O
2949.7974K
2848.5985P
2679.7396M
2467.597D
2396.1758A
2380.2929H
2285.87410C
2247.68211G
2238.72912L
2235.9413B
2181.59114N
2031.12515J
1744.79616I
  • I worked it out as 

    Store Rank =
    RANKX ( ALLSELECTED(Table[Store] ),
    [Total Sales] , , asc, dense)
    and this seems to be working