DATESYTD
The dates from the start of the year to the last date in the filter context (the year ending on 31 December, or on a date given).
Group: Time intelligence. Compatible with DAX.
Syntax
DATESYTD ( <dates> [, <year_end_date>] )
| Parameter | Type | Description |
|---|---|---|
dates | Dates | A column of dates of the model, such as Sales[Month], or the name of a calendar defined in the model. |
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
Table. The column's dates from the start of the year to the last date in the filter context.
Remarks
- The year is the one of the last date in the filter context; it starts the day after the year end before.
- Given a column, it reads the dates visible in the current filter context; in a row context, such as
ADDCOLUMNS, the row becomes a filter first, so each row sees its own dates. - Used as a filter in
CALCULATE, it gives a year-to-date figure:TOTALYTDsays the same thing shorter. - Only dates the column holds come back: a date the move or the period lands on that the column lacks is left out, and when none is left the table is empty.
- A column that does not hold dates, such as a year number, is an error.
- 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
The months of the year so far
EVALUATE
CALCULATETABLE (
DATESYTD ( Sales[Month] ),
Sales[Month] = DATE ( 2025, 4, 1 )
)
ORDER BY Sales[Month]
| Sales[Month] |
|---|
| 2025-01-01 |
| 2025-02-01 |
| 2025-03-01 |
| 2025-04-01 |
A year that ends on 31 March
April is the first month of such a year.
EVALUATE
CALCULATETABLE (
DATESYTD ( Sales[Month], "3-31" ),
Sales[Month] = DATE ( 2025, 4, 1 )
)
| Sales[Month] |
|---|
| 2025-04-01 |