LASTDATE

The LASTDATE function returns the last day in the current context for the specified date column.

Syntax

LASTDATE(
    dates
)

Parameters
  • dates: Column containing dates.
Returned value

The LASTDATE function returns a table containing a single column with a single row with a date value.

Additional Information

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.

Examples

Consider the following table containing dates of sales:

LASTDATE function. Example of use

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:

LASTDATE function. Example of use

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:

LASTDATE function. Example of use

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.

Related functions
Category
Time intelligence
Submitted by admin on Tue, 12/04/2018 - 11:16