This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
Hi All,
i really need help on this one. I copied the measure to get Top5 & Others (i copied, it is too advance for my PBI knowledge). It works perfectly but i have a problem with the sorting. As you can see in the picture, everything is sorted by SALES (Measure) but i would need to keep "ZZ_Other" Category always at the bottom. I am using the formula below to get the Top5 & Others Measure. Where i can adjust it the keep "Others" always at the bottom while keeping everything else sorted by sales.
Thanks
Luca
APIwOthers Sales PY =
VAR Items =
SELECTCOLUMNS ( ALL ( NewAPI ), "RankItem", NewAPI[API Description] )
VAR ItemsWithValue =
ADDCOLUMNS (
Items,
"RankMeasure", CALCULATE ( [Sales], ALL ( XXX_API[API Description] ) )
)
VAR ItemsWithRank =
ADDCOLUMNS (
ItemsWithValue,
"Rank", RANKX ( ItemsWithValue, [Sales], [Sales], DESC, DENSE )
)
VAR ItemsWithTop =
ADDCOLUMNS (
ItemsWithRank,
"TopOrOthers", IF ( [Rank] <= 5, [RankItem], "ZZ_Other APIs" )
)
VAR ItemsFinal =
SELECTCOLUMNS (
FILTER (
ItemsWithTop,
CONTAINSROW ( VALUES ( NewAPI[API Description] ), [TopOrOthers] )
&& CONTAINSROW ( VALUES ( XXX_API[API Description] ), [RankItem] )
),
"TopN_Others", [RankItem]
)
RETURN
CALCULATE ( [Sales PY], TREATAS ( ItemsFinal, NewAPI[API Description] ) )
Actual Result
Solved! Go to Solution.
Hi @Anonymous,
You can create a custom sort table with all category values and index who used to setting 'sort by column' property. Then you can use category link to raw table and use new table category fields on the matrix to achieve custom sorting.
Custom Sorting in Power BI
Regards,
Xiaoxin Sheng
Hi @Anonymous,
You can create a custom sort table with all category values and index who used to setting 'sort by column' property. Then you can use category link to raw table and use new table category fields on the matrix to achieve custom sorting.
Custom Sorting in Power BI
Regards,
Xiaoxin Sheng
@Anonymous - Have you taken a look at → https://www.sqlbi.com/articles/showing-the-top-5-products-and-others-row/
Proud to be a Super User!
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 32 | |
| 25 | |
| 23 | |
| 22 | |
| 13 |
| User | Count |
|---|---|
| 61 | |
| 47 | |
| 27 | |
| 24 | |
| 19 |