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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
thelauraams
New Member

TopN dynamic with slicers

Hi all!

 

I am facing an issue to make my TOP5 table dynamic with my slicers.

I want to display the TOP5 customers based on sales, but I need that table to be dynamic depending on the selection of the slicers.

CustomerSales
A800
B500
C400
D100
E50

For now, my table is based on a "TOPN filter" in the filter pane. But I noticed that if I select something in the slicers at the top of the page (department, country, region etc) the TOPN will not be dynamic.

 

For example, if I select on my slicer country= Singapore, I would like to see the TOP5 customers in Singapore.

If I select country= Singapore and department= Asset Management, I would like to see the TOP5 customers in Singapore inside the department Asset Management. 

 

Any recommendation please?

 

Many thanks!

Laura 

 

1 REPLY 1
amitchandak
Super User
Super User

@thelauraams , use topn with allselected

 

example

Top3 = calculate(sum(Table1[sales]),TOPN(3,allselected(table[Customer]),sum(Table1[sales]),DESC), values(table[Customer]))

 

Also, Refer

https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/3...

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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