The FIRSTDATE function returns the first day in the current context for the specified date column.
FIRSTDATE(
dates
)
- dates: Column containing dates.
The FIRSTDATE 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 of any function that requires a table, but it can also be used where a date is required.
Consider the following Ventas table containing sales dates:
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 column is given by the month in which the sale occurred. If we now define the Primera Venta measure:
Primera venta = FIRSTDATE(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:
That is, the first of the dates included in the Ventas[Fecha] column is displayed in the Primera venta column within the context defined by each row.