Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Rank with custom sort
12-19-2023
03:24 AM
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 |
Solved! Go to Solution.
1 ACCEPTED SOLUTION
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023
06:53 AM
I worked it out as
Store Rank =
RANKX ( ALLSELECTED(Table[Store] ),
[Total Sales] , , asc, dense)
and this seems to be working
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023
06:53 AM
I worked it out as
Store Rank =
RANKX ( ALLSELECTED(Table[Store] ),
[Total Sales] , , asc, dense)
and this seems to be working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023
06:44 AM
Hi @maurcoll,
What if you put a minus before [Total Sales]?
Store Rank =
RANKX ( ALLSELECTED(Table[Store] ),
-[Total Sales] )

Helpful resources
Announcements
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Recommendations
Subject | Author | Posted | |
---|---|---|---|
02-19-2024 06:41 AM | |||
12-07-2024 01:31 AM | |||
11-21-2024 04:58 AM | |||
09-14-2022 08:30 AM | |||
11-22-2024 04:22 AM |
Featured Topics