Home

DATESYTD

DatesYTD is a DAX function used in Power BI, Excel Data Model, and related environments to return a table of dates representing the year-to-date period for given dates. The function takes two arguments: dates, a column of dates to base the calculation on, and an optional year_end_date that defines the end of the fiscal year. If year_end_date is omitted, the year boundary defaults to December 31 of the year containing the date.

How it works: For each date in the dates column, DATESYTD returns the sequence of dates from

Example: TotalSalesYTD = CALCULATE(SUM(Sales[Amount]), DATESYTD(DimDate[Date])) Another example using a fiscal year end date: CALCULATE(SUM(Sales[Amount]), DATESYTD(DimDate[Date], DATE(2024, 6,

Notes: DATESYTD returns a table, not a scalar, and is intended to work with time-intelligence functions. For

the
start
of
the
year
(as
defined
by
year_end_date)
up
to
that
date.
When
used
in
CALCULATE,
the
resulting
filter
table
constrains
calculations
to
the
year-to-date
period.
It
is
commonly
used
with
a
properly
marked
date
dimension.
30)))
accurate
results,
use
a
dedicated
date
table
marked
as
such,
and
ensure
the
dates
column
is
continuous.