Power BI Error Reference_

EARLIER/EARLIEST refers to an earlier row context which doesn't exist.

EARLIER was used without a surrounding (nested) row context to step back into.

Why it happens

How to fix it

  1. Use a variable instead: VAR curr = Table[Col] RETURN COUNTROWS ( FILTER ( Table, Table[Col] < curr ) ).
  2. If you do need EARLIER, ensure it sits inside a nested iterator (e.g. a FILTER inside a calculated column).
  3. Prefer VAR in all new code — it's readable and avoids this class of error entirely.
Fix
Rank = VAR curr = Sales[Amount] RETURN 1 + COUNTROWS ( FILTER ( Sales, Sales[Amount] > curr ) )