Sub topic 10
Month to Date and Quarter to Date
This chapter assumes you can write basic DAX measures, have a marked date table related to a fact table, and know that CALCULATE changes the filter context. It reuses [Total Sales] and the 'Date' table from earlier chapters.
Same pattern, different period
Year to date uses DATESYTD. Month to date and quarter to date work the same way, with DATESMTD and DATESQTD. Each function returns a table of dates. CALCULATE then uses that table as the new date filter.
| Period | Date function | Shorthand |
|---|---|---|
| Month to date | `DATESMTD` | `TOTALMTD` |
| Quarter to date | `DATESQTD` | `TOTALQTD` |
| Year to date | `DATESYTD` | `TOTALYTD` |
Writing the measures
Both measures are shown below in their shorthand form and in their CALCULATE form. The two forms return the same result.
Sales MTD = TOTALMTD ( [Total Sales], 'Date'[Date] )
Sales QTD = TOTALQTD ( [Total Sales], 'Date'[Date] )
Sales MTD (CALCULATE) =
CALCULATE ( [Total Sales], DATESMTD ( 'Date'[Date] ) )
Sales QTD (CALCULATE) =
CALCULATE ( [Total Sales], DATESQTD ( 'Date'[Date] ) )The CALCULATE form is worth learning. You can add more filters to it, such as a product category, and you can combine it with other date logic.
What the functions return
The functions look at the last date in the current filter context. DATESMTD returns every date from the first day of that date's month up to that date. DATESQTD does the same from the first day of the quarter.
Suppose a report row is filtered to 18 May 2025. Then Sales MTD sums sales from 1 May to 18 May, and Sales QTD sums sales from 1 April to 18 May, because calendar quarters start in January, April, July and October.
The diagram below shows how the three "to date" windows nest inside each other for a single day.
How each visual behaves
The result depends on the filter context of the visual.
- In a daily table, each row shows a running total that restarts at the start of the month or quarter.
- In a monthly matrix, each month shows the total from the start of the month to the month's last date. For a complete month,
Sales MTDtherefore equals the monthly total. - In a quarterly matrix, a month row for
Sales QTDshows the running total since the start of the quarter. For example, March shows January through March.
Common errors
- A card shows the whole-period value. With no date filter, the last date in context is the last date in the table, so the measure returns the total up to that date.
- Wrong start of quarter. The quarter functions use calendar quarters. For fiscal quarters, build the quarter into your date table and filter on it instead.
- Values after the last sale. The window keeps growing for future dates, so the line runs flat. The incomplete-periods chapter shows how to blank those dates.
Exercise
A matrix row is filtered to 10 August 2025. Between which dates does Sales QTD sum sales, and between which does Sales MTD sum?
Show answer
Sales QTD sums from 1 July 2025 to 10 August 2025, because August falls in the quarter starting in July. Sales MTD sums from 1 August 2025 to 10 August 2025.
Exercise
Write a quarter-to-date measure for [Total Sales] using CALCULATE instead of TOTALQTD.
Show answer
Sales QTD = CALCULATE ( [Total Sales], DATESQTD ( 'Date'[Date] ) )