DAX TOTALYTD Function
Calculate Year-To-Date in DAX.
TOTALYTD
is a Time Intelligence function that calculates the Year-To-Date (YTD) total of a measure.
Syntax
TOTALYTD(
<expression>,
<dates>,
[<filter>],
[<year_end_date>]
)
Parameters
Parameter | Description |
---|---|
expression | The measure or calculation to aggregate (e.g., [Sales] ). |
dates | A column with date values (usually from a Date table). |
filter | (Optional) Additional filters to apply. |
year_end_date | (Optional) Specify a different fiscal year-end date (default is Dec 31). |
Example
Assuming you have a measure [Total Sales]
and a proper 'Date'
table:
Sales YTD = TOTALYTD([Total Sales], 'Date'[Date])
This gives cumulative sales from the start of the year up to each date in the context.
Custom Fiscal Year Example
If your fiscal year ends on June 30th:
Sales YTD = TOTALYTD([Total Sales], 'Date'[Date], , "06/30")
Note: The date format in
"06/30"
must match your system's locale settings (e.g.,"30/06"
for DD/MM).
Important Notes
- You must have a proper Date table marked as a Date Table in your model.
- The
dates
column should be continuous with no gaps. - The result depends on the current row context, often from a visual or iterator.
No questions available.