Forum Discussion

AUaero's avatar
AUaero
Icon for Responsive Resident rankResponsive Resident
6 years ago
Solved

RANKX inconsistent results

Hi,
I am have a measure that ranks sales people by a defined KPI ($ Rolling GM per Ton).

# OSR GM per Ton Rank = 
RANKX(
    FILTER(
        ALL(OSRs[OSR_NAME]),
        NOT(ISBLANK(OSRs[OSR_NAME]))
    ),
    Sales[$ Rolling GM per Ton],
    ,
    DESC,
    DENSE
)

 $ Rolling GM per Ton is a measure that calculates GM per ton for the previous year period.

$ Rolling GM per Ton = 
CALCULATE(
    Sales[$ GM per Ton],
    DATESBETWEEN(
        'Calendar'[DATE_DESC],
        NEXTDAY(SAMEPERIODLASTYEAR(LASTDATE('Calendar'[DATE_DESC]))),
        LASTDATE('Calendar'[DATE_DESC])
    )
)

I have created a table visual consisting of the sales person name, $ Rolling GM per Ton, and # OSR GM per Ton Rank.  The table has a visual level relative date filter setting 'Calendar'[DATE_DESC] to show results in the last 365 days.  This visual correctly ranks each sales person.

I have created a card visual that displays # OSR GM per Ton Rank.  When I select a row for a specific sales person in my table visual, I would expect the card visual to display the same value for #OSR GM per Ton Rank that is displayed in the table.  However, this is not the case.  The card visual generally shows one rank lower than what is displayed in the table.  For example, if the rank in the table is 2, the card visual displays 3.  This is not consistent, though.  For some sales people, the rank displayed is the same in the card and in the table.

I feel like there is something I'm missing in the filter context being applied to the # OSR GM per Ton Rank measure when it is displayed outside the table visual, but I can't figure it out.

Any ideas?

Thanks!

3 Replies