aym
aym

Reputation: 233

Using RANKX with a YTD Measure does not rank correctly

I am trying to calculate the Cumulative Purchases by YTD. The first step is to rank the items by Cost Amount, but when I try to rank by the [_YTD Cost] measure, the numbers I get do not make sense (skipped numbers, duplicated).

[enter image description here]

I had 3 slicers: Month, Year and to select Month/YTD measures. Since with the Month calculation I have no problems, I removed the interaction with the Month/YTD slicer and I placed only YTD measures on the table:

Total Purchase Cost = SUM ( Purchases[Amount] )

_YTD Cost = TOTALYTD([Total Purchase Cost], 'dim-calendar'[Date])

_RANK YTD = RANKX(ALLSELECTED(Purchases), [_YTD Cost])

Notes:

  1. I pulled the item from the Item table
  2. The Purchase table is linked to the Date table by Purchase Date

Upvotes: 0

Views: 590

Answers (1)

ffffrank
ffffrank

Reputation: 544

Not 100 % sure on your data model, but try changing your RANKX(ALLSELECTED(***) to reference the Item-column. Like this:

RANKX(ALLSELECTED('Item'[Item]), [_YTD Cost])

Upvotes: 0

Related Questions