Forum Discussion
Paula
8 years agoHelper I
Rank with the same numbers
Hello! i'm having some problems whit the function RANKX. What can i do if i have the same amount in different categories and i want to do a rank? i want to see only the top 5, but the rank 5 is 1...
Greg_Deckler
8 years agoCommunity Champion
Try specifying Dense as an option, the default is Skip.
https://msdn.microsoft.com/en-us/query-bi/dax/rankx-function-dax
Paula
8 years agoHelper I
Hi Greg_Deckler
i'm using Dense, but the rank is the same when i have the same amount for different categories.
- Greg_Deckler8 years agoCommunity Champion
OK, so my understanding is that you want the top 5 categories. But, some of the categories have the same amount that you are ranking on. I guess my question is, how do you want it to work? In your scenario where you have a bunch of ranking "5", do you want it to randomly pick one? What is your expectation?
- Paula8 years agoHelper I
- Greg_Deckler8 years agoCommunity Champion
Possibly, you would want to use the RAND function to generate a random number. Alternatively, you could just use MAX or MIN on the category to grab the first or last one.