16.7Month-to-date or quarter-to-date
How much have you sold since the start of the quarter? A function returns the days that run from the first day of the period to the last date of the row.
16.7.1DATESQTD and DATESMTD
In Excel
| DAX | DATESQTD | DATESMTD |
|---|---|---|
| Excel | SUMIFS, from the start of the quarter up to the date | SUMIFS, from the start of the month up to the date |
| Match |
You need them to follow a number since the start of the quarter or the month, like the revenue of the quarter up to the last date of the row.
DATESQTD returns the days since the start of the quarter, up to the last date of the context. DATESMTD starts from the start of the month.
Each one 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 from the start of the quarter to the last date shown.”
- On the January 2025 row, it keeps January, 200,000.
- On the February 2025 row, it keeps January and February, 350,000.
- On the March 2025 row, the whole quarter, 500,000.
- On the May 2025 row, a new quarter begins. It keeps April and May, 150,000.
Month
January 2025
February 2025
March 2025
April 2025
May 2025
June 2025
| Month Name | Quarter-to-Date Revenue |
|---|---|
| January 2025 | 200,000 |
| February 2025 | 350,000 |
| March 2025 | 500,000 |
| May 2025 | 150,000 |
| June 2025 | 150,000 |
| Total | 150,000 |
This is a reproduction of the Power BI interface for teaching purposes. It differs from the real interface.
April has no sales, and its row disappears. The “Total” row starts from 6/30/2025, and keeps April, May and June, 150,000. The total therefore does not add up the rows of the visual, and that is not an error.
DATESMTD follows the same pattern, from the first day of the month. It is mostly useful in a visual by day, because in a visual by month it gives back the number of the whole month.
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 farm already has a “Liters” measure, the sum of the “Liters” column of the “Milking” table. The “Days” date table, with its “Date” column, is marked and linked to “Milking.” In a visual by month, write the “Liters Quarter to Date” measure, from the first day of the quarter to the last date of the row.
Milking Date Liters 7/15/2026 400 8/15/2026 350 9/15/2026 420 Which formula should you write for “Liters Quarter to Date”?
Combined useMeasureDifficulty
A garage records each repair on a row of the “Repairs” table. The “Repairs” measure counts these rows. The “Days” date table, with its “Date” column, is marked and linked to “Repairs.” In a visual by month, write the “Month Share of Quarter” measure, the share of the repairs of the month among those of the quarter so far.
Repairs Vehicle Date V-101 12/15/2025 V-102 1/8/2026 V-103 2/20/2026 Direct useMeasureDifficulty
A pastry shop records its croissants each day in the “Production” table. The “Days” date table, with its “Date” column, is marked and linked to “Production.” No measure exists yet. In a visual by day, write the “Croissants Month to Date” measure, the sum of the “Croissants” column since the first day of the month. DATESMTD is used like DATESQTD.
Production Date Croissants 4/1/2026 80 4/2/2026 95 4/3/2026 70 Combined useMeasureDifficulty
The pastry shop records each batch on a row of the “Batches” table. The “Batches” measure counts these rows. The “Days” date table, with its “Date” column, is marked and linked to “Batches.” In a visual by day, write the “Batches on Earlier Days” measure, the number of batches made since the start of the month, without counting those of the day of the row.
Batches Batch Date B1 3/31/2026 B2 4/1/2026 B3 4/2/2026 B4 4/2/2026
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.