OpenBI Docs Buy

LASTNONBLANK

The last of a column's values, in their order, for which an expression is not blank.

Group: Time intelligence. Compatible with DAX.

Syntax

LASTNONBLANK ( <column>, <expression> )
ParameterTypeDescription
columnColumnThe column whose values are gone through, in their sort order: dates, numbers or text. A table of one column works too: VALUES ( Periods[Month] ), or one made in the query, such as a variable's or CALENDAR's.
expressionExpression
evaluated for each row
Tried for each value, from the last, until it is not blank; usually a measure.

Returns

Table. The last value of the column for which the expression is not blank, as a table of one row.

Remarks

  • The values are those visible in the filter context, largest first: dates from the latest.
  • It is the usual way to find the last date with data on a date table, where LASTDATE gives the table's last date whatever happened on it.
  • The expression sees each value as a row, not as a filter. A measure turns the row into a filter by itself; a plain aggregation does not, and then the column's last value passes (the second example): wrap it in CALCULATE.
  • When no value qualifies, the table is empty and shows as blank.

Examples

The last month with actuals

EVALUATE
ROW (
    "Last month with actuals",
        CALCULATE ( LASTNONBLANK ( Periods[Month], [Booked amount] ), Ledger[Scenario] = "Actual" )
)
Last month with actuals
2026-09-01

A measure, or a plain aggregation

SUM without CALCULATE is not filtered by each month, so December 2026, the last month of Periods, passes.

EVALUATE
CALCULATETABLE (
    ROW (
        "Plain SUM", LASTNONBLANK ( Periods[Month], SUM ( Ledger[Amount] ) ),
        "With CALCULATE", LASTNONBLANK ( Periods[Month], CALCULATE ( SUM ( Ledger[Amount] ) ) )
    ),
    Ledger[Scenario] = "Actual"
)
Plain SUMWith CALCULATE
2026-12-012026-09-01

FIRSTNONBLANK, LASTNONBLANKVALUE, LASTDATE, CALCULATE.

Last updated · OpenBI Studio 0.3.74