16.3The whole previous period
With DATEADD, you shift the days of the context. Sometimes you will rather want the whole month or year that comes before. That is the job of PREVIOUSMONTH and PREVIOUSYEAR.
16.3.1PREVIOUSMONTH
In Excel
| Excel | SUMIFS between the two ends of the period (EOMONTH…) |
|---|---|
| Match |
You need it when you want, next to each month, the number of the whole month before.
PREVIOUSMONTH returns all the days of the previous month, starting from the first date of the context.
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:
“I want the revenue, going back one whole month.”
On the March 2025 row, PREVIOUSMONTH starts from the first date of the context, 3/1/2025, and returns all the days of February 2025. CALCULATE replaces the filter on the dates with them, and the measure returns the number of February, 150,000. On a row that shows a single day, January 10, 2025, it returns all of December 2024, not December 10.
Year
2024
2025
| Month Name | Revenue Month Before |
|---|---|
| February | 200,000 |
| March | 150,000 |
| April | 150,000 |
| June | 150,000 |
| August | 150,000 |
| October | 100,000 |
| Total |
This is a reproduction of the Power BI interface for teaching purposes. It differs from the real interface.
The months whose previous month has no sales, like January or May, disappear. The “Total” row starts from 1/1/2025, and December 2024 has no sales.
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.
Direct useMeasureDifficulty
A swimming pool already has a “Swimmers” measure, the sum of the “Swimmers” column of the “Pool” table. The “Days” date table, with its “Date” column, is marked and linked to “Pool.” In a visual by month, write the “Swimmers Month Before” measure, which takes the whole previous month.
Pool Date Swimmers 5/14/2026 250 5/28/2026 310 6/11/2026 400 Which formula should you write for “Swimmers Month Before”?
Combined useMeasureDifficulty
A weather station records the rain in the “Readings” table, in millimeters. The “Rain” measure adds up the “Rain” column. The “Days” date table, with its “Date” column, is marked and linked to “Readings.” In a visual by month, write the “Change from Month Before” measure, by how much the rain of the month changed compared with the previous month.
Readings Date Rain 3/2/2026 12 3/20/2026 8 4/15/2026 5
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.