Downloads
DAXFilter and contextAdvanced

EARLIEST

Returns the value of a column from the outermost row context, the row where the nesting started.

Syntax
EARLIEST(<column>)

Returns: A scalar value.

What it does

EARLIEST works like EARLIER, but it goes all the way out to the outermost row context instead of one level up. It matters only when a formula has nested row contexts, such as a FILTER inside another iterator. Most models never need it. With only one level of nesting, EARLIER and EARLIEST return the same value.

Syntax and arguments

Example

A calculated column on Sales counts the other lines for the same product and the same store that have a larger amount than this line. Each row in the outer loop is the sales line being calculated.

Same Product Lines Above =
COUNTROWS (
    FILTER (
        Sales,
        Sales[ProductKey] = EARLIEST ( Sales[ProductKey] )
            && Sales[StoreKey] = EARLIER ( Sales[StoreKey] )
            && Sales[SalesAmount] > EARLIER ( Sales[SalesAmount] )
    )
)

In this single loop, the outermost row and the calculated line are the same row, so EARLIEST and EARLIER return the same values. The example shows the syntax. The two functions differ only when a second iterator wraps the first, so check the results with a small table before you rely on either.

Things to watch

In business terms

Rarely needed in finance reporting. It is useful when reviewing an older workbook or model that uses nested row logic, such as ranking lines within a store within a region, and you need to know what the formula does before you change it.

Related functions

All DAX functions · View as Markdown · DAX fundamentals