The EARLIER function in DAX is used to access data from an earlier (outer) row context while you’re working inside a nested row context — it basically lets you refer back to a value from a previous level of iteration.
In simple terms, when you have a calculation happening inside multiple row contexts — for example, when using functions like CALCULATE, FILTER, or iterators like SUMX inside a calculated column — EARLIER allows you to refer to the value of a column from the outer row context while still evaluating the inner one.
Let me explain with an example. Suppose I have a Sales table with columns CustomerID, OrderID, and Amount, and I want to calculate each customer’s sales rank within their group. I can create a calculated column like this:
Sales Rank =
COUNTROWS(
FILTER(
Sales,
Sales[CustomerID] = EARLIER(Sales[CustomerID]) &&
Sales[Amount] > EARLIER(Sales[Amount])
)
) + 1
Here, the first Sales[CustomerID] and Sales[Amount] inside FILTER refer to the inner row context (the one FILTER is iterating through), while EARLIER(Sales[CustomerID]) and EARLIER(Sales[Amount]) refer back to the outer row context — the current row of the main calculated column.
In one of my Power BI reports, I used EARLIER to create rank-based or running total calculations before the RANKX function was introduced. It helped me compare each transaction against others for the same customer.
A challenge I faced was that EARLIER can be confusing when you have more than two nested contexts — it’s hard to track which “earlier” level you’re referring to. The formula can become difficult to debug.
Nowadays, I often use variables (VAR) and functions like RANKX or CALCULATE instead of EARLIER because they make the logic cleaner and easier to read.
So, in short — EARLIER is a way to refer to a value from an outer row context while evaluating an inner one, mostly used in calculated columns for row-by-row comparisons, though newer DAX techniques often make it unnecessary.
