The LASTDATE function returns the last day in the current context for the specified date column.
LASTDATE(
dates
)
- dates: Column containing dates.
The LASTDATE function returns a table containing a single column with a single row with a date value.
The dates argument can be a reference to a column containing dates, an expression that returns a table with a single column containing dates, or a Boolean expression that defines a table with a single column containing dates.
This function can be used as an argument to any function that requires a table, but it can also be used where a date is required.
Consider the following table containing dates of sales:
If we take this information to a matrix in which we have the name of the month in rows and the sum of the sales amounts in columns, we have:
Under these conditions, the context of the cells in the Importe ("Amount") column is given by the month in which the sale occurred. If we now define the Última Venta ("Last Sale") measure:
Última venta = LASTDATE(Ventas[Fecha])
... in which we add as an argument the column of the sales table that includes the dates on which the sales occurred, by taking this measure to the matrix we obtain:
In other words, the last of the dates included in the Sales[Date] column is displayed in the Última venta column within the context defined in each row.