Forum Discussion
Rank by measure in Direct Query
Hello All,
I'm trying to rank Branch Locations by a measure that finds the % of products with no sales to total inventory. When I try to create the rank measure in the visual all the locations are ranked #1. I haven't had much luck with the rank function in Power BI but maybe I'm doing something wrong.
Formula: RANKX(ALLSELECTED(table1[Branch Location], CALCULATE(DIVIDE(SUM(table2[no sales value]), SUM(table1[total inventory value])),,DESC,Skip)
I've seen other examples and it works just fine for those users, but can't figure out why it won't work for me.
Any ideas?
Thanks
30 Replies
- amitchandakSuper User
I assume it is only copy-paste mistake and the actual formula is
RANKX(ALLSELECTED(table1[Branch Location]), CALCULATE(DIVIDE(SUM(table2[no sales value]), SUM(table1[total inventory value]))),,DESC,Skip)There were issues with (.
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- nleuckPost Patron
- amitchandakSuper User
What is the issue? Are getting the same rank. try one with All, in place of allselected and check if is giving expected results