Biggest movers: rank change year over year with RANKX

Compare each customer’s rank in 2024 and 2025 to see who climbed the leaderboard and who slipped.

You will learn to

  • Rank by a different measure for each period
  • Subtract two ranks so a positive number means a climb
  • Store intermediate ranks in variables

How it works

A rank is only as good as the measure behind it. Rank by `[Sales 2024]` and you get last year’s leaderboard; rank by `[Sales 2025]` and you get this year’s. Both are ordinary RANKX calls over `ALL(Customer)`.

The interesting number is the **difference**. A smaller rank number is better, so “places gained” is the old rank minus the new rank: moving from 10th to 4th is 10 − 4 = **+6**. Subtract the other way round and every climber shows a negative number.

Variables keep this readable: one `VAR` per rank, then `RETURN` the difference.

Practice it hands-on with a real data model and a live report that updates as you type.

Units Rank Gap =
VAR BySales = RANKX(ALL(Product), [Total Sales])
VAR ByUnits = RANKX(ALL(Product), SUM(Sales[Quantity]))
RETURN BySales - ByUnits