DAX function
DATESYTD — DAX function reference
Year-to-date date set.
Syntax
dax
DATESYTD(<dates>, [<year_end_date>])
Examples
dax
CALCULATE(SUM(Sales[Amount]), DATESYTD('Date'[Date]))→ A number
dax
CALCULATE(SUM(Sales[Amount]), DATESYTD('Date'[Date], "6/30"))→ The same fiscal YTD as TOTALYTD, written as a filter-returning function
dax
VAR YTDSales = CALCULATE(SUM(Sales[Amount]), DATESYTD('Date'[Date]))
VAR YTDBudget = CALCULATE(SUM(Budget[Amount]), DATESYTD('Date'[Date]))
RETURN DIVIDE(YTDSales, YTDBudget) - 1→ YTD actual-vs-budget variance %
Common mistakes & gotchas
- DATESYTD returns a table of dates, not a scalar — it must be used as a CALCULATE filter argument (or fed into another table function), whereas TOTALYTD wraps that pattern into a single call.
- Same date-table requirement as all time intelligence: mark the Date table explicitly (Model view > Mark as date table) or these functions can return misleading results with no error.
Related DAX functions
From Time intelligence