Forum Discussion
categories in different Top n
we have following table, for different category different top n are requirent, for ex: the result should look like below. shoes need top 3, books top 3, polish top2, Accesorries top1. Kindly help with solution
- Anonymous4 years ago
Hi Anonymous ,
Here are the steps you can follow:
1. Create calculated column.
rank = RANKX(FILTER(ALL('Table'),'Table'[Category]=EARLIER('Table'[Category])),[sales])2. Create measure.
Flag = SWITCH( TRUE(), MAX('Table'[Category])="shoes",IF(MAX('Table'[rank])<=3,1,0), MAX('Table'[Category])="polish",IF(MAX('Table'[rank])<=2,1,0), MAX('Table'[Category])="book",IF(MAX('Table'[rank])<=3,1,0), MAX('Table'[Category])="Accessorie",IF(MAX('Table'[rank])>=3,1,0))3. Place [Flag]in Filters, set is=1, apply filter.
4. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
2 Replies
- Hariharan_R
Solution Sage
Hi,
I have provided a solution for same scenario. Please check
Thanks
Hari
Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.
My Blog :: YouTube Channel :: My Linkedin - AnonymousNot applicable
Hi Anonymous ,
Here are the steps you can follow:
1. Create calculated column.
rank = RANKX(FILTER(ALL('Table'),'Table'[Category]=EARLIER('Table'[Category])),[sales])2. Create measure.
Flag = SWITCH( TRUE(), MAX('Table'[Category])="shoes",IF(MAX('Table'[rank])<=3,1,0), MAX('Table'[Category])="polish",IF(MAX('Table'[rank])<=2,1,0), MAX('Table'[Category])="book",IF(MAX('Table'[rank])<=3,1,0), MAX('Table'[Category])="Accessorie",IF(MAX('Table'[rank])>=3,1,0))3. Place [Flag]in Filters, set is=1, apply filter.
4. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly