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.
v-yulgu-msft
7 years agoMicrosoft Employee
Hi Anonymous,
Why is the highlighted value different?
How is the data in source table like? What is the formula of [Tol_Sales]? You said "Tol Sales" sums all sales, but why did you compare it with TopN selection?
Best regards,
Yuliana Gu
Anonymous
7 years agoNot applicable
Sry, it was a typo. I added the original post some prints and a pbix file.