Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi all,
My goal is to show top 20 master by metric Sales and the rest will be grouped like 'Others'.
I'm working with RANKX to be able rank values, but it is showing 11111 insted of 1,2,3,4,5.
Can you tell me what I'm doing wrong please?
Result (excel version)
This is my Power BI file: https://drive.google.com/file/d/1HagYTmRAdT6SFQd1HXw7CM10jwrFFOcy/view?usp=sharing
Thank you for your help on this issue.
Lucie
Solved! Go to Solution.
Hi @lucie_raboch based on my understanding on the data model, here is the calculated table , please test it if it works, not able to upload pbix file
Wow, yes, It is working now! Thank you for this solution.
Hi,
Ranking is working now, but I need to remove Master from the table to see only top 20 rows and Others and if I remove Master Column then Master Group is BLANK.
Also how can I sort according to the Rank?
Hi @lucie_raboch does creating a calculated table and using its columns in a table visual work for you?
like this
This is my PowerBI file: https://drive.google.com/file/d/1HagYTmRAdT6SFQd1HXw7CM10jwrFFOcy/view?usp=sharing
Can you create this table in this file and share back please?
Because it's not working properly and I don't know why.
Hi @lucie_raboch based on my understanding on the data model, here is the calculated table , please test it if it works, not able to upload pbix file
Hi @lucie_raboch please check this measure for grouping
Hi @lucie_raboch for ranking you can use this
where [sales amount] is a measure as this--
Thank you for your answer, but your solution doesnt work, still getting 1,1,1,1,1
Hi @lucie_raboch ,
To create a proper ranking for your "Master" by Sales in Power BI and group everything outside the Top 20 as "Others", you need to use RANKX in a way that evaluates all values in the dataset regardless of what’s currently being filtered by the visual. The reason you were getting only 1s is likely because the RANKX function was evaluating over a single visible row context due to the table visual.
You can fix it by first calculating the ranking using the ALL function inside RANKX to remove any filters on the "Master" column. Here's the corrected measure:
Ranking =
RANKX(
ALL('YourTable'[Master]),
CALCULATE(SUM('YourTable'[Sales])),
,
DESC,
DENSE
)
To create a grouping for Top 20 and "Others", define a new column or measure like this:
Master Group =
VAR CurrentRank =
RANKX(
ALL('YourTable'[Master]),
CALCULATE(SUM('YourTable'[Sales])),
,
DESC,
DENSE
)
RETURN
IF(CurrentRank <= 20,
SELECTEDVALUE('YourTable'[Master]),
"Others"
)
Then you can use Master Group as the row field in your matrix and sum of Sales as the value. This will show the Top 20 masters individually and group everything else under "Others".
If you want to make sure “Others” always shows up at the bottom, create a sort order measure like this:
Sort Order =
VAR CurrentRank =
RANKX(
ALL('YourTable'[Master]),
CALCULATE(SUM('YourTable'[Sales])),
,
DESC,
DENSE
)
RETURN
IF(CurrentRank <= 20, CurrentRank, 999)
Use this to sort the "Master Group" column. This ensures that "Others" comes last in your visual.
Best regards,
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
16 | |
13 | |
12 | |
11 | |
11 |
User | Count |
---|---|
19 | |
14 | |
14 | |
11 | |
9 |