Forum Discussion
RANKX returning variable, TOP 1, 2, 3, 4
- 5 years ago
- Anonymous5 years ago
Hi rauerfc ,
Please try the following formula to create measures :
sum = CALCULATE(SUM('Table'[Quantity Sales]),ALLEXCEPT('Table','Table'[MRK]))rank = RANKX(FILTER(ALL('Table'),'Table'[Manager]=MAX('Table'[Manager])),[sum],,DESC,Dense)If you want to separately get the rank value , you could use this:
Top 1 MRK = CALCULATE(MAX('Table'[MRK]),FILTER('Table',[rank]=1))The final output is shown below:
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
What result are you expecting. Explain the question clearly and show the expected result.
- rauerfc5 years agoFrequent Visitor
I need one measure that's going to calculate the TOP 1 selling MRK.
So if I select this Acc. Manager, the best-selling MRK will be 130.
And another measure to return the second best, third best, and fourth-best.
- Ashish_Mathur5 years agoSuper User
- rauerfc5 years agoFrequent Visitor
Thank you for your reply.
I used your solution and it worked, is giving me the best selling, second best etc.
And now my goal is to use this as a filter for the graph, for example:
So I want to filter information from the second-best for this graph:
I'm using your formula:
mrk_cons_2 = CALCULATE(FIRSTNONBLANK(TOPN(1, VALUES(tab_mrk[MRK]),[sum_rank]),1), FILTER(VALUES(tab_mrk[MRK]),[rank_mrk]>1))