Forum Discussion
Rankx Issue: Resulting in Incorrect Figures
- 1 year ago
Hi, peterpan Thanks for asking question.
Seems like you have some issues with DAX. FltrTbl contains only customers with positive growth.
However, when the visual is on a customer with negative growth, RANKX still takes that customer’s [Total Sales] and ranks it against the positive-growth set , so you still get a rank instead of BLANK. That’s why rows like SalesGrowth% = -6% show a rank.
You can try this dax, at first it will filter all positive growth items then do the ranking
Rank Among Positives := IF( [SalesGrowth%] > 0, RANKX( FILTER( ALLSELECTED(DimCustomer[Customer Code]), [SalesGrowth%] > 0 ), [Total Sales], , DESC, DENSE ) )Find this helpful? ✔ Give a Kudo • Mark as Solution – help others too!
Hi, peterpan Thanks for asking question.
Seems like you have some issues with DAX. FltrTbl contains only customers with positive growth.
However, when the visual is on a customer with negative growth, RANKX still takes that customer’s [Total Sales] and ranks it against the positive-growth set , so you still get a rank instead of BLANK. That’s why rows like SalesGrowth% = -6% show a rank.
You can try this dax, at first it will filter all positive growth items then do the ranking
Rank Among Positives :=
IF(
[SalesGrowth%] > 0,
RANKX(
FILTER( ALLSELECTED(DimCustomer[Customer Code]), [SalesGrowth%] > 0 ),
[Total Sales],
,
DESC,
DENSE
)
)
Find this helpful? ✔ Give a Kudo • Mark as Solution – help others too!