DAX Function Guide

LASTNONBLANK
Empty image or helper icon

Sam McKay

CEO & Founder

How does the LASTNONBLANK work?
The LASTNONBLANK function (DAX) returns the last value in the column that is filtered by the current context where the expression is not blank.
LASTNONBLANK Formula Syntax

LASTNONBLANK(
     <column>,<expression>
)

How do you use the LASTNONBLANK?

A table which contains a single column and a single row with the last calculated value.

Usually this function is used to return the final value of a column for which the expression is not void. For instance, you could get the final value for which a product had been sold.

Related Blog Posts

Loading

Considerations when using the LASTNONBLANK?

The dates parameter can be any of the following −

  • A reference to a date/time column.
  • A table expression that returns a single column of date/time values.
  • A Boolean expression that defines a single-column table of date/time values.

Constraints on Boolean expressions −

  • The expression cannot reference a calculated field.
  • The expression cannot use CALCULATE function.
  • The expression cannot use any function that scans a table or returns a table, including aggregation functions.

However, any function that looks up a single value, or calculates a scalar value, may be used by a Boolean expression.

Related Video Tutorials

Loading

Formula examples using the LASTNONBLANK

=LASTNONBLANK (
     (Sales [Sales Amount], MIN (Sales [Date])>2/12/2019)
)

Related Courses

Loading