Forum Discussion
Ranking - negative or positive
Hi all,
As shown in the example below, I would like to rank the companies by sales variance. Result should show Top 5 ranking by biggest variance number regardless if it is a -ve or +ve number.
Thanks in advance.
Use the ABS function to render all values positive and then use that in the RANKX measure. (Or new column)
This blog post may help (if you wish to display the actual rank):
Rankx(all(Table[compnay]), calculate(abs(sum(table[sales variance]))),,asc,dense)
by adding ABS function it gives the desired output.
Thanks
4 Replies
- amitchandak
Super User
mb0307 , create ascending rank on sales variance
rankx(all(Table[compnay]), calculate(sum(table[sales variance])),,asc,dense)
you can use topN too
https://databear.com/power-bi-dax-topn-function/
For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/367415- mb0307
Responsive Resident
Rankx(all(Table[compnay]), calculate(abs(sum(table[sales variance]))),,asc,dense)
by adding ABS function it gives the desired output.
Thanks
- PaulDBrown
Community Champion
Use the ABS function to render all values positive and then use that in the RANKX measure. (Or new column)
This blog post may help (if you wish to display the actual rank):