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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Snapdrag
Helper II
Helper II

Dynamic TOPN measure at month level

I want to find Top 10 products. I want to check month wise sales of those top 10 product.
Top 10 products should be calculated dynamically I have to apply multiple filters on this(ex: location, category)

My ask is build the TopN visual level filter manually with help of DAX measures.

 

sample data

ProductsMonth YearSalesLocationCategory

A1/1/202320IndiaClothing
B1/1/202325USTransport
C1/1/202320ChinaCostume
D1/1/202323UKHousehold
E1/1/202324GermanyLaptop
A2/1/202310USClothing
B2/1/202312IndiaTransport
C2/1/202311GermanyCostume
D2/1/202330ChinaHousehold
E2/1/202350GermanyLaptop
A3/1/202340ChinaClothing
B3/1/202350GermanyTransport
C3/1/202340IndiaCostume
D3/1/202330USHousehold
E3/1/202310GermanyLaptop
A4/1/202310GermanyClothing
B4/1/202320USTransport
C4/1/202310USCostume
D4/1/202330ChinaHousehold
E4/1/202340IndiaLaptop

 

expected output :

Snapdrag_0-1687181238184.png

 

 

1 REPLY 1
WinterMist
Impactful Individual
Impactful Individual

@Snapdrag 

 

I am confused by your expected result.

 

It shows a matrix, listing Products B, C & E, which applies to all Month Year combinations.

This cannot be - because each month, the Top N Products will be different.

 

For example, if there are no slicer values selected, then the Top 3 for each month+year will be as follows.

- Jan 2023 = B, E, D

- Feb 2023 = E, D, B

- Mar 2023 = B, A, C

- Apr 2023 = E, D, B 

 

In my XLS analysis screenshot below, color coding is arbitrary:

- Blue = #1 highest value in given month

- Orange = #2...

- Green = #3...

- Yellow = highlights how the Top 3 Products cannot be the same for all months, as the Top 3 Products are constantly changing for each month.

 

WinterMist_0-1687276391797.png

 

Would it be possible to provide a new Excel file screenshot of your desired results, when no slicer values are selected?  I'm not yet understanding what you want to see.

 

NOTE 1: When using TOPN in a given measure, the entity for which you are calculating is typically NOT shown in the visual.  For example, because we are doing TOPN "Products" in the measure, "Products" would typically NOT be shown in the visual.  Instead you would display something like the Sales for TOPN products across other entities, such as time, location, category etc.

 

NOTE 2: If you are desiring to display the entity (e.g. "Product") in the visual and wanting to get the TOPN for that entity (e.g. "Product"), then typically you would use the GUI TOPN functionality in the visual Filters in PBI.  (Even in this case, you could not have the same set of Products be the same Top 3 across all months.)

 

Regards,

Nathan

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.