Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
MichaelaMul
Helper III
Helper III

Slicer with Top N

Hello!

I was wondering if there's a way to create a slicer that shows the Top N of a category. So you can for example have the top brands for Apples, Oranges and Blueberries in a slicer, and the slicer be Apple, Orange, and Blueberry. When you click on Apple then you'd be able to see a line graph with all the Top 5 apple brands in one chart and then cllick on Orange and see the same for orange.

 

Thank you!

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @MichaelaMul 

You can create a numeric range parameter table which column and automatically created measure can be used to filter a rank measure.

danextian_0-1741061159449.png

This measure ranks all distinct values in the Model column according to their sales. The ALL function is used applied to the Model column, ensuring that filters from other related columns remain effective.

Model Rank by Sales = 
RANKX ( ALL ( 'Product'[Model] ), [Total Sales],, DESC, DENSE )

You can create another measure to returns just the sales of the models which ranks are <= the selected rank value.

Top N Model Sales = 
CALCULATE (
    [Total Sales],
    FILTER ( VALUES ( 'Product'[Model] ), [Model Rank by Sales] <= [TopN Value] )
)

danextian_1-1741061421407.png

Please see the attached pbix.

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @MichaelaMul,

 

Thanks @danextian  and @Ashish_Mathur for Addressing the issue.

 

we would like to follow up to see if the solution provided by the super user resolved your issue. Please let us know if you need any further assistance.
If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

 

Regards,
Vinay Pabbu

Anonymous
Not applicable

Hi @MichaelaMul,

 

we would like to follow up to see if the solution provided by the super user resolved your issue. Please let us know if you need any further assistance.
If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

 

Regards,
Vinay Pabbu

Anonymous
Not applicable

Hi @MichaelaMul,

 

we would like to follow up to see if the solution provided by the super user resolved your issue. Please let us know if you need any further assistance.
If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.

 

Regards,
Vinay Pabbu

danextian
Super User
Super User

Hi @MichaelaMul 

You can create a numeric range parameter table which column and automatically created measure can be used to filter a rank measure.

danextian_0-1741061159449.png

This measure ranks all distinct values in the Model column according to their sales. The ALL function is used applied to the Model column, ensuring that filters from other related columns remain effective.

Model Rank by Sales = 
RANKX ( ALL ( 'Product'[Model] ), [Total Sales],, DESC, DENSE )

You can create another measure to returns just the sales of the models which ranks are <= the selected rank value.

Top N Model Sales = 
CALCULATE (
    [Total Sales],
    FILTER ( VALUES ( 'Product'[Model] ), [Model Rank by Sales] <= [TopN Value] )
)

danextian_1-1741061421407.png

Please see the attached pbix.

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Ashish_Mathur
Super User
Super User

Hi,

Select Fruit in a slicer and in a table visual drag categories.  Write this measure

Total = sum(sum(Data[units])

Measure = calculate([Total],top(3,all(Data[Category]),[Total]),values(Data[Category]))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
lbendlin
Super User
Super User

yes, that is possible.  What have you tried and where are you stuck?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.