LASTNONBLANK Function (DAX)

How does the LASTNONBLANK function (DAX) 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 function?

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

Related Support Forum Posts

Last Sale Amount- LASTNONBLANK()
Using LASTNONBLANK in Power BI – DAX Function Deep Dive
Last non blank date, unfiltered

Considerations when using the LASTNONBLANK function

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

Formula examples using the LASTNONBLANK function

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

Related DAX Functions

Related Course Modules

Ultimate-Beginners-Guide-To-PowerBI
Center of Excellence

DOWNLOAD


Download our comprehensive DAX Formula Reference Guide as perfect companion as you learn how to use DAX formulas within Power BI.


Download DAX Formulas Reference Guide
Download DAX Formula Reference Guide
Membership