DAX TOTALYTD function

Calculates a value from the start of the year to the last date in view.

TOTALYTD gives year-to-date figures in one line. It restarts every January (or at a year end you choose) and needs a proper date table.

Syntax

TOTALYTD(<expression>, <dates>[, <filter>][, <year_end_date>])
ArgumentRequiredDescription
expressionRequiredWhat to accumulate, usually a measure.
datesRequiredThe date column of your date table.
filterOptionalAn extra filter, as in CALCULATE.
year_end_dateOptionalA fiscal year end, like "06-30". Default is December 31.

Returns: A decimal number.

Examples

Calculated on the free practice data (table financials), with [Total Sales] = SUM(financials[Sales]) and [Total Profit] = SUM(financials[Profit]).

1. Sales year-to-date by month

Sales YTD = TOTALYTD([Total Sales], Dates[Date])
Month YearSales YTD
Sep 20134,484,000.03
Oct 201313,779,611.13
Nov 201321,046,814.43
Dec 201326,415,255.51
Jan 20146,607,761.69
Feb 201413,905,293.08
Mar 201419,492,152.95

The total keeps growing through 2013, then starts again in January 2014.

Good to know

  • The date column must come from a date table with every day and no gaps, marked as date table.
  • The long form is CALCULATE([Total Sales], DATESYTD(Dates[Date])).

Related functions

Official reference: TOTALYTD function on Microsoft Learn