Forum Discussion
Anonymous
7 years agoNot applicable
Dynamic TopN with RankX
Hello everyone, I have a base with a lot of products, and i want to show the sales of each product along the time in a line chart. To make the chart more clean, i want to make a dynamic top filt...
- Anonymous7 years ago
It is unclear on what you mean with "make it work different".
Are you trying to show the 4 items with the highest total sales over a year? or just during the month?
EDIT:
If took your example file and created the following measure:
SubTotal = CALCULATE(SUM(Base[Valor Total]);ALLEXCEPT(Base;Base[marca]))
I then changed your TopN Measure to:
TopN_total_sales = VAR SelectedTop = SELECTEDVALUE('TopN'[TopN]) var RankMarca = RANKX(ALL(Base[marca]);[SubTotal]) RETURN IF(RANKX(ALL(Base[marca]);[SubTotal])<=SelectedTop;[total_sales];BLANK())I'll get this as a result:
Result
I hope that this solves your problem!
Kind Regards.
PS: If it does solve your problem please mark this as answer.
themistoklis
7 years agoCommunity Champion
Anonymous
Have you tried adding the month, the product and measure in a matrix as is and then on the filter pane select the top2.
Measure = tablename[Total Sales]
See image below:
Anonymous
7 years agoNot applicable
Yes, i want to make it work just like the TopN filter, but i want to make it dynamic.