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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Niels_T
Post Patron
Post Patron

How to show top 5 and lowest 5 in pie chart dynamically with dates and different brands

Hello,

 

I have multiple pie charts in my reports with sales, orders, add to carts, etc. based on products.

 

I would like to make a top 5 and the lowest 5 with a pie chart as we have many different products.

 

In this report we also use dates and different brands so it also has to  be dynamic in a way that whenever I select a date and particular brand the data changes according to those selections.

 

 I tried different ways like looking at the filters on the visual, but I can't find anything about TopN or something.

 

- N

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Niels_T , a measure like

 

Top and bottom= CALCULATE([Sales],TOPN(5,all(product[brand]),[Sales],DESC),VALUES(product[brand])) + CALCULATE([Sales],TOPN(5,all(product[brand]),[Sales],asc),VALUES(product[brand]))

 

or measures like

 

Rank1 = RANKX(all(product[brand]),[Sales],,desc)


Rank2 = RANKX(all(product[brand]),[Sales],,desc)

Rank Top Bottom = sumx(VALUES(product[brand]),if([Rank1]<=5 || [Rank2] <=5,[Sales],BLANK()) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

timg
Solution Sage
Solution Sage

Hi Niels,

Do you want one piechart to contain either a top 5 or bottom 5? Or did you mean it would have to contain both at the same time? If you want to visualize just the top or bottom 5 per visual there is a top N option in de filter pane. see reference image

example top Nexample top N

Regards,

Tim





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

Proud to be a Super User!




View solution in original post

2 REPLIES 2
timg
Solution Sage
Solution Sage

Hi Niels,

Do you want one piechart to contain either a top 5 or bottom 5? Or did you mean it would have to contain both at the same time? If you want to visualize just the top or bottom 5 per visual there is a top N option in de filter pane. see reference image

example top Nexample top N

Regards,

Tim





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

Proud to be a Super User!




amitchandak
Super User
Super User

@Niels_T , a measure like

 

Top and bottom= CALCULATE([Sales],TOPN(5,all(product[brand]),[Sales],DESC),VALUES(product[brand])) + CALCULATE([Sales],TOPN(5,all(product[brand]),[Sales],asc),VALUES(product[brand]))

 

or measures like

 

Rank1 = RANKX(all(product[brand]),[Sales],,desc)


Rank2 = RANKX(all(product[brand]),[Sales],,desc)

Rank Top Bottom = sumx(VALUES(product[brand]),if([Rank1]<=5 || [Rank2] <=5,[Sales],BLANK()) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.