NEXTMONTH

The NEXTMONTH function returns a table containing a column with the dates corresponding to the month after the current context.

Syntax

NEXTMONTH(
    dates
)

Parameters
  • dates: Column containing dates.
Returned value

The NEXTMONTH function returns a table.

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 returns the set of dates corresponding to the month 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.

Examples

If we define two measures returning the first and the last day of the period returned by the NEXTMONTH function for the Date column of the calendar:

firstDateNextMonth = 
VAR __nextMonth = NEXTMONTH('Calendar'[Date])
RETURN
    FIRSTDATE(__nextMonth)
lastDateNextMonth = 
VAR __nextMonth = NEXTMONTH('Calendar'[Date])
RETURN
    LASTDATE(__nextMonth)

...and we create a table to which we take the mentioned Date field and both measures, the result is the following:

NEXTMONTH function

We see how, for each date in the first column, the period defined by the NEXTMONTH function begins on the 1st of the following month and ends on the last day of the following month.

If, given a table with sales, we define the measure:

Ventas = SUM(FactSales[SalesAmount])

...calculating the total sales, and the measure:

Ventas siguiente mes = CALCULATE(
    [Ventas],
    NEXTMONTH(DimDate[Datekey])
)

...to calculate the sales of the following month, and we take both measures to a table in which we place days, months and years in the row header, we obtain the following result:

NEXTMONTH function. usage example

It can be seen how the calculation of the sales of the following month for the days of January coincides with the total sales of the month of February.

If, in the previous scenario, we take years and quarters to the row headers, the result is the following:

NEXTMONTH function. usage example

In this case, the [Next Month Sales] measure returns the total sales for the month following each quarter. We can confirm this by viewing the sales per month:

NEXTMONTH function. usage example

Indeed, the calculation of the measure [Sales following month] for the first quarter of 2007 (€276,891,048.16) coincides with the total sales for the month of April.

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