- Create a measure to calculate rank using below code.
Rank = RANKX(ALLSELECTED(Sheet1[Type]),CALCULATE(SUM(Sheet1[Amount])),,DESC,Dense)
( Here the selecting all data for type in sheet1 and then calculating sum and displaying the rank in descending order. )
- Then create another measure to group the top n as "Top N" others into "Others" group.
group = IF([Rank]<=Parameter[Parameter Value],"Top N","OTHERS")
- Add a parameter for selecting n value.
- Then click ok. Now drag the pointer on the slicer for selecting n value.
- Then add the column for displaying top n and others as a column.
Hope this helps you.