Forum Discussion
TOP Achiever Analysis
I have a problem with ranking negative values in my data using DAX. Here is an example of my data:
Year Customer Name ROS
| 2022 | Client A | -0.38% |
| 2022 | Client B | 8.05% |
| 2022 | Client C | 0.89% |
| 2022 | Client D | 14.53% |
| 2022 | Client E | -3.55% |
| 2022 | Client F | -0.69% |
I want to rank the customers based on their ROS for the year 2022. The correct ranking should be:
- Client D (14.53%)
- Client B (8.05%)
- Client C (0.89%)
- Client A (-0.38%)
- Client F (-0.69%)
However, my dashboard is only showing 4 customers when I select the top 5. How can I fix this so it shows all 5 customers correctly, including the ones with negative values?
i Think the problem with my dax especially the below part:
- BeaBF2 years ago
Super User
Romani Ok, here my measures to correctly rank Clients as in your output:
Avg ROS = SELECTEDVALUE('Credit Benchmarking'[ROS.3])Customer ROS Rank =RANKX(ALL('Credit Benchmarking'[Customer Name]),[Avg ROS],,DESC,DENSE)as you can see:So, modify the AVG ROS.
BBF
- Romani2 years ago
Helper II
to undestand well i have slicer for top achiever
when iam chosing the top 5 as the above picture, the output is that showing me only top 4:
when iam pasting your DAXCustomer ROS Rank =RANKX(ALL('Credit Benchmarking'[Customer Name]),[Avg ROS],,DESC,DENSE) it deleting the rank selection- BeaBF2 years ago
Super User
Romani Ok, Clear. So we need to modify the logica.
Instead of a measure, calculate this new column and put it as tooltip on your visual:
ROS Rank =RANKX(ALL('Credit Benchmarking'), 'Credit Benchmarking'[ROS.3],, DESC, Dense)then create this measure:Flag_TOP = IF(SELECTEDVALUE('Credit Benchmarking'[ROS Rank]) <= 'Ranking Selection'[Ranking Select], "TRUE", "FALSE")Apply this Flag in the filter pane of your visual and set it to "TRUE".It will work:If you send me your email, i can send you my pbix example file.
BBF