16.4Neighboring periods

PREVIOUSMONTH looks back. Sometimes you will want to look ahead, or to jump several periods at once. Other functions do that.

16.4.1NEXTMONTH and its neighbors

You need it when you want, next to each month, the number of the following month.

NEXTMONTH returns all the days of the following month, starting from the last date of the context.

NEXTMONTH( <dates> )

It expects a single argument, the date column of the date table, here Calendar[Date]. Let us put this measure in a table by month:

Revenue Next Month = CALCULATE( [Revenue], NEXTMONTH( Calendar[Date] ) )
Power BI accepts this DAX foryes, Measureyes, Calculated columnno, Calculated tableno, Virtual table
In plain words

“I want the revenue, moving forward one whole month.”

On the February 2025 row, the last date is 2/28/2025. NEXTMONTH returns the days of March 2025, and the measure returns 150,000, sale V008.

Year

2024

2025

Table visual, The “Revenue Next Month” measure by month, in 2025
Month NameRevenue Next Month
January150,000
February150,000
April150,000
June150,000
August100,000
November50,000
Total

This is a reproduction of the Power BI interface for teaching purposes. It differs from the real interface.

The “Total” row starts from 12/31/2025. The calendar stops at that date. NEXTMONTH finds no day of January 2026, and the row stays blank. This blank does not point to any error in your formula.

Tip

NEXTDAY, NEXTQUARTER and NEXTYEAR follow the same pattern. On the 2024 row, CALCULATE( [Revenue], NEXTYEAR( Calendar[Date] ) ) returns the whole year 2025, 950,000.

The PREVIOUS functions start from the first date of the context, the NEXT functions from the last one.

Practice

Each exercise is solved with the function you just discovered. Two exercises per function, a direct use and a combined use, from easiest to hardest, on data other than the course data. Pick the right formula out of five.

  1. Direct useMeasureDifficulty

    A travel agency already has a “Travelers” measure, the sum of the “Travelers” column of the “Departures” table. The “Days” date table, with its “Date” column, is marked and linked to “Departures.” In a visual by month, write the “Travelers Next Month” measure, which takes the whole following month.

    Departures
    DateTravelers
    6/12/202640
    7/3/202650
    7/25/202635

    Which formula should you write for “Travelers Next Month”?

  2. Combined useMeasureDifficulty

    The agency wants to know by how much the number of travelers changes from one month to the next. The “Travelers” measure adds up the “Travelers” column of the “Departures” table. The “Days” date table, with its “Date” column, is marked and linked to “Departures.” In a visual by month, write the “Increase Next Month” measure.

    Departures
    DateTravelers
    6/12/202640
    7/3/202650
    7/25/202635
  3. Direct useMeasureDifficulty

    A hotel already has an “Arrivals” measure, the sum of the “Guests” column of the “Arrivals” table. The “Days” date table, with its “Date” column, is marked and linked to “Arrivals.” In a visual by day, write the “Arrivals Next Day” measure, to prepare the rooms the day before.

    Arrivals
    DateGuests
    8/14/202612
    8/15/202618
    8/16/20269
  4. Combined useMeasureDifficulty

    The hotel wants to know, each day, how many times more guests will arrive the next day. The “Arrivals” measure adds up the “Guests” column of the “Arrivals” table. The “Days” date table, with its “Date” column, is marked and linked to “Arrivals.” In a visual by day, write the “Ratio to Next Day” measure, with DIVIDE.

    Arrivals
    DateGuests
    8/14/202612
    8/15/202618
    8/16/20269
  5. Direct useMeasureDifficulty

    A language school already has a “Students” measure, the sum of the “Students” column of the “Enrollments” table. The “Days” date table, with its “Date” column, is marked and linked to “Enrollments.” In a visual by month, write the “Students Next Quarter” measure, which takes the whole following quarter.

    Enrollments
    DateStudents
    5/11/202615
    7/6/202650
    9/14/202640
  6. Combined useMeasureDifficulty

    The school wants to know whether the following quarter attracts more students than the month of the row. The “Students” measure adds up the “Students” column of the “Enrollments” table. The “Days” date table, with its “Date” column, is marked and linked to “Enrollments.” In a visual by month, write the “Trend” measure, which shows “Up” or “Down.”

    Enrollments
    DateStudents
    5/11/202615
    7/6/202650
    9/14/202640
  7. Direct useMeasureDifficulty

    A wine estate records its harvests in the “Harvests” table. The “Days” date table, with its “Date” column, is marked and linked to “Harvests.” No measure exists yet. In a visual by year, write the “Bottles Next Year” measure, the sum of the “Bottles” column over the whole following year.

    Harvests
    DateBottles
    9/20/2024900
    9/18/20251100
    10/25/2025300
  8. Combined useMeasureDifficulty

    The estate wants to know by how much its harvest changes from one year to the next. The “Days” date table, with its “Date” column, is marked and linked to “Harvests.” No measure exists yet. In a visual by year, write the “Change to Next Year” measure, from the “Bottles” column.

    Harvests
    DateBottles
    9/20/2024900
    9/18/20251100
    10/25/2025300

The rest of this lesson is part of izyDAX Pro

You have just read the first section. The next one, its animations, the exercises and the summary are waiting for you with izyDAX Pro, in a single payment.