Sub topic 10
Month to Date and Quarter to Date
Month to date (MTD) and quarter to date (QTD) work like year to date, but the running total resets at the start of each month or quarter. This chapter assumes you have read the year-to-date chapter. You should be comfortable with CALCULATE, a marked date table with no gaps, and the way a visual's filter context reaches a measure. The base measure used throughout is Total Sales = SUM ( Sales[Sales Amount] ).
The same pattern at a smaller scale
Year to date is built from DATESYTD or TOTALYTD. MTD and QTD have matching functions.
| Period | Dates function | Shorthand |
|---|---|---|
| Year to date | `DATESYTD` | `TOTALYTD` |
| Quarter to date | `DATESQTD` | `TOTALQTD` |
| Month to date | `DATESMTD` | `TOTALMTD` |
Each dates function returns a single-column table of dates. The table runs from the first day of the period to the last date in the current filter context. Each shorthand function wraps that table in CALCULATE.
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 two forms in each pair return the same numbers. Use the CALCULATE form when you need to combine the period with other filters, because it is easier to extend.
How the dates are chosen
The functions do not know about the period shown in the visual. They look at the dates that survive in the filter context and use the last one.
Consider a matrix with days on the rows. On 2026-03-18, the filter context holds one date. DATESMTD returns 2026-03-01 through 2026-03-18. The sales total is summed over those 18 days, so each row shows the running total for its month.
Now consider a matrix with months on the rows. The row for March 2026 holds all 31 dates. The last visible date is 2026-03-31, so Sales MTD for that row equals the full March total. The same happens with quarters: a quarter row shows the total of the whole quarter, because the last visible date is the last day of the quarter.
Both periods in one visual
A matrix with the date on the rows and these measures as columns shows how the resets work:
| Date | Total Sales | Sales MTD | Sales QTD |
|---|---|---|---|
| 2026-03-30 | 100 | 2,900 | 7,400 |
| 2026-03-31 | 120 | 3,020 | 7,520 |
| 2026-04-01 | 90 | 90 | 90 |
| 2026-04-02 | 80 | 170 | 170 |
On April 1, both measures drop back to that day's sales. April is the first month of the second calendar quarter, so the month and the quarter start on the same day. In the middle of a quarter, only MTD resets, and QTD keeps growing.
Using the optional filter argument
TOTALMTD and TOTALQTD accept a third argument, a filter expression that is applied on top of the date logic. It follows the same rule as TOTALYTD: the filter is added to the date filter and does not replace it.
Sales MTD Online =
TOTALMTD (
[Total Sales],
'Date'[Date],
Sales[Channel] = "Online"
)In practice, many authors skip the argument and write the CALCULATE form with an extra filter, because it reads in a clearer order.
Sales MTD Online (CALCULATE) =
CALCULATE (
[Total Sales],
DATESMTD ( 'Date'[Date] ),
Sales[Channel] = "Online"
)Quarters follow the calendar, not the fiscal year
TOTALYTD and DATESYTD accept a year-end date, which is how you build a fiscal year-to-date measure. TOTALQTD, TOTALMTD, DATESQTD, and DATESMTD have no such argument. A quarter is always a calendar quarter: January to March, April to June, July to September, and October to December.
If your fiscal year ends on June 30, the first fiscal quarter is July to September. That happens to match a calendar quarter, so TOTALQTD still works. If the fiscal year ends on a different month, such as November or February, the fiscal quarters no longer align with calendar quarters, and TOTALQTD returns the wrong period. Months are never an issue, because a fiscal month is still a calendar month.
Fiscal quarter to date with a date table column
When fiscal quarters do not match calendar quarters, add columns that describe the fiscal calendar. This example assumes a fiscal year that starts in September and ends in August. The fiscal year is named for the calendar year in which it ends.
Fiscal Year =
YEAR ( 'Date'[Date] ) + IF ( MONTH ( 'Date'[Date] ) >= 9, 1, 0 )Fiscal Quarter Number =
INT ( MOD ( MONTH ( 'Date'[Date] ) - 9, 12 ) / 3 ) + 1Fiscal Quarter Key =
'Date'[Fiscal Year] * 10 + 'Date'[Fiscal Quarter Number]For September, MOD ( 9 - 9, 12 ) is 0, so the quarter number is 1. For November, MOD ( 2, 12 ) is 2, which is still quarter 1. For December, MOD ( 3, 12 ) is 3, so the quarter number is 2. For August, MOD ( -1, 12 ) is 11 in DAX, because MOD takes the sign of the divisor. That gives INT ( 11 / 3 ) + 1, which is 4.
The measure picks the fiscal quarter of the last visible date. It then keeps the dates of that quarter up to the last visible date.
Sales FQTD =
VAR LastVisibleDate = MAX ( 'Date'[Date] )
VAR CurrentQuarterKey = MAX ( 'Date'[Fiscal Quarter Key] )
RETURN
CALCULATE (
[Total Sales],
FILTER (
ALL ( 'Date' ),
'Date'[Fiscal Quarter Key] = CurrentQuarterKey
&& 'Date'[Date] <= LastVisibleDate
)
)ALL ( 'Date' ) removes the existing date filters, and the FILTER call supplies the new ones. The variables are read before CALCULATE runs, so they still hold the values from the visual's filter context.
Showing MTD or QTD for the current period only
A running total looks odd when the visual extends past the last day with data. For dates after the last sale, MTD and QTD repeat the final value. Use the same guard as in the year-to-date chapter.
Sales MTD Capped =
VAR LastSaleDate =
CALCULATE ( MAX ( Sales[Order Date] ), ALL ( 'Date' ) )
RETURN
IF ( MAX ( 'Date'[Date] ) <= LastSaleDate, [Sales MTD] )For a month in the past, every row is at or before the last sale date, so nothing changes. For the current month, rows after the last sale show blank.
Common errors with MTD and QTD
- A running total that never resets. The visual puts a non-date column, such as a text month name from the fact table, on the axis. The measure then sees filters on the wrong table. Use columns from the date table on the axis.
- MTD equal to the monthly total. The visual is at month level. Add the day to the axis or use a table with daily rows.
- Wrong quarters for a fiscal year.
TOTALQTDuses calendar quarters. Build fiscal columns as shown above. - Gaps in the date table. If days are missing, the last visible date can fall on the wrong day, and the totals may stop early. The date table must be contiguous.
- Using the fact table's date column in the function. Pass
'Date'[Date], notSales[Order Date]. Time intelligence functions need the marked date table to produce a full date list.
Validating your measures
Pick one day and compute the answer by hand. For example, filter a table of orders to March 1 through March 18 and add up the amounts. Compare the result to the Sales MTD value shown for March 18. Do the same on the first day of a month, where MTD must equal that day's sales. Repeat on the first day of a quarter, where both MTD and QTD must equal that day's sales.
Exercise
A matrix shows the date on the rows and Sales QTD = TOTALQTD ( [Total Sales], 'Date'[Date] ) as a column. On May 10, the value is 4,000. On May 11, there are 300 in sales. What does the QTD column show for May 11, and what does Sales MTD show for June 1 if sales that day are 250?
Show answer
The QTD value for May 11 is 4,300, because May 11 is still inside the same calendar quarter (April to June) and the running total adds that day's sales. Sales MTD for June 1 is 250. The month resets on June 1, and the only date in the range from the first of the month to the last visible date is June 1 itself.
Exercise
Your company has a fiscal year ending on January 31, so its first fiscal quarter is February to April. Why can't you use TOTALQTD for fiscal quarter to date, and what do you need instead?
Show answer
TOTALQTD always uses calendar quarters (January to March, and so on), and it has no year-end argument. A fiscal quarter of February to April crosses calendar quarter boundaries, so the result would reset in the wrong month. Add a fiscal quarter key column to the date table, then write a measure that stores the last visible date and its fiscal quarter key in variables. The measure then uses CALCULATE with FILTER ( ALL ( 'Date' ), ... ) to keep dates in that quarter up to the last visible date.