Chapter 9: Date & Time Functions 2/2: Time Intelligence Functions 281
Analysis
LASTDATE(), FIRSTDATE(), and BLANK() are often used to establish date ranges.
There are a few examples here. Try them one at a time to understand what the DAX
is doing. The second example shows the increase (or decrease) from the first to the last
day within the current context. In 1997, sales on the last day of the year for Beverages
were 124 down on the first day. The last example ignores the Category slicer.
LASTNONBLANK()
LASTNONBLANK() is similar to LASTDATE(). However, if the value for the last date is
blank, it will search backward in time until it finds the first non-blank value.
The example is a measure on the Order Details table.
Syntax
=CALCULATE(SUM('Order Details'[Sales Amount]),
LASTNONBLANK(Orders[OrderDate],SUM('Order Details'[Sales Amount])))
Result