TOTALYTD
An expression evaluated over the year to date (the year ending on 31 December, or on a date given).
Group: Time intelligence. Compatible with DAX.
Syntax
TOTALYTD ( <expression>, <dates> [, <filter>] [, <year_end_date>] )
| Parameter | Type | Description |
|---|---|---|
expression | Expression | The value wanted, usually a measure; it is evaluated with the dates as its filter. |
dates | Dates | A column of dates of the model, such as Sales[Month], or the name of a calendar defined in the model. |
filter | Filter optional | A condition or a table that filters as well, as a filter argument of CALCULATE does. |
year_end_date | Text optional | The year's last day as month and day, such as "6-30" for a year that ends on 30 June; when left out, 31 December. Not used with a calendar, whose own years count. |
Returns
Same type as the expression. The expression over the year to date.
Remarks
- It is
CALCULATE ( expression, DATESYTD ( dates ) ), with the filter added when one is given. - With three arguments, a text in the third place is read as the year end, not as a filter:
TOTALYTD ( [Liters sold], Sales[Month], "6-30" ). - The year runs to the last date in the filter context, so on a total row that spans years it shows the last year only.
- A filter on another column of the same table (a month or a year column next to the dates) stays in place. Where the dates column links a date table to the facts, a filter on it replaces the filters on the rest of that table, so results by year and month name add up as expected.
- Given a calendar instead of a column, it works on the calendar's own periods (fiscal years, retail months of four or five weeks, ISO weeks). A filter on a category the calendar does not define, such as a month on a calendar of weeks, can make the call an error.
Examples
Liters, year to date
EVALUATE
ADDCOLUMNS (
DATESBETWEEN ( Sales[Month], DATE ( 2025, 1, 1 ), DATE ( 2025, 4, 1 ) ),
"Liters", [Liters sold],
"Year to date", TOTALYTD ( [Liters sold], Sales[Month] )
)
ORDER BY Sales[Month]
| Sales[Month] | Liters | Year to date |
|---|---|---|
| 2025-01-01 | 44635 | 44635 |
| 2025-02-01 | 44831 | 89466 |
| 2025-03-01 | 43593 | 133059 |
| 2025-04-01 | 44318 | 177377 |
A season to June, and one product
The season starts again in July; the filter keeps to Pils.
EVALUATE
SUMMARIZECOLUMNS (
Sales[Month],
FILTER ( VALUES ( Sales[Month] ), Sales[Month] >= DATE ( 2025, 5, 1 ) && Sales[Month] <= DATE ( 2025, 8, 1 ) ),
"Liters", [Liters sold],
"Season to date", TOTALYTD ( [Liters sold], Sales[Month], "6-30" ),
"Pils, year to date", TOTALYTD ( [Liters sold], Sales[Month], Sales[Product] = "Pils" )
)
ORDER BY Sales[Month]
| Sales[Month] | Liters | Season to date | Pils, year to date |
|---|---|---|---|
| 2025-05-01 | 49448 | 536988 | 123965 |
| 2025-06-01 | 59243 | 596231 | 156760 |
| 2025-07-01 | 64419 | 64419 | 192520 |
| 2025-08-01 | 59266 | 123685 | 224763 |
By month name, on a related date table
Periods[Month] links Periods to the ledger, so the year to date adds up across the month names.
EVALUATE
CALCULATETABLE (
ADDCOLUMNS (
SUMMARIZE ( Periods, Periods[Month name], Periods[Month number] ),
"Booked", [Booked amount],
"Year to date", TOTALYTD ( [Booked amount], Periods[Month] )
),
Periods[Year] = 2025,
Periods[Month number] <= 3,
Ledger[Scenario] = "Actual"
)
ORDER BY Periods[Month number]
| Periods[Month name] | Periods[Month number] | Booked | Year to date |
|---|---|---|---|
| Jan | 1 | 173711931.53 | 173711931.53 |
| Feb | 2 | 174582610.98 | 348294542.51 |
| Mar | 3 | 170760571.54 | 519055114.05 |
Related functions
DATESYTD, TOTALQTD, TOTALMTD, CALCULATE, SAMEPERIODLASTYEAR.