The NEXTYEAR function returns a table containing a column with the dates corresponding to the year following the current context.
NEXTYEAR(
dates
[, year_end_date]
)
- dates: Column containing dates.
- year_end_date: Optional argument. Text string that defines the end of the year (the default is December 31).
The NEXTYEAR function returns a table.
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 returns the set of dates corresponding to the year that follows the dates involved in the current context. In other words, the set of dates returned by the function is never part of the current context.
The year_end_date argument is a text string containing a date in the local computer format and allows you to specify an end of the year other than December 31st. Although this argument must include a year (for example, "10/21/2016"), only the day and month are considered.
If, given a table with sales, we define the measure:
Ventas = SUM(FactSales[SalesAmount])
...calculating the total sales, and the measure:
Ventas siguiente año = CALCULATE(
[Ventas];
NEXTYEAR(DimDate[Datekey])
)
...calculating the sales of the following year, and we take these measures to a matrix with months and years at the head of the rows, the result is the following:
It can be seen how, for each month, the measure containing the sales of the following year coincide with the total sales of the year that begins the month of January following the month of the current context.