The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi folks,
Data structure:
Category A: Product1,Product2,Product3.....so on
Category B: Product1,Product2,Product3.....so on
I want to calculate Top 5 and Bottom 5 products within each category.For Top 5 Products within each category I have used this formula:
Top 5 Products within each category =
VAR RankingContext = VALUES(‘Dim Products’[Products])
return
CALCULATE([Sum of sales],TOPN(5,ALL(‘Dim Products’[Products]),[Sum of sales]),RankingContext)
I am using Category and Product(Drill down) in rows section of Matrix and the Measure " Top 5 Products within each category" in the values section.
Its working well for Top 5 but I need help in calculating the bottom 5 products within each category.
Thanks in advance.
Hi @Ajinkya369,
Can please share some dummy data with a similar data structure and expected results? It should help us clarify your scenario and test to coding formula.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
Hey @amitchandak ,
Thanks for the reply! It is for Top N products within each category whereas I am looking for Bottom N Products within each category.
Thanks,
Ajinkya
@Ajinkya369 , refer if this can help
https://www.sqlbi.com/articles/filtering-the-top-3-products-for-each-category-in-power-bi/
User | Count |
---|---|
77 | |
77 | |
36 | |
32 | |
29 |
User | Count |
---|---|
93 | |
79 | |
57 | |
48 | |
48 |