OpenBI Docs Buy

TOTALYTD

An expression evaluated over the year to date (the year ending on 31 December, or on a date given).

Group: Time intelligence. Compatible with DAX.

Syntax

TOTALYTD ( <expression>, <dates> [, <filter>] [, <year_end_date>] )
ParameterTypeDescription
expressionExpressionThe value wanted, usually a measure; it is evaluated with the dates as its filter.
datesDatesA column of dates of the model, such as Sales[Month], or the name of a calendar defined in the model.
filterFilter
optional
A condition or a table that filters as well, as a filter argument of CALCULATE does.
year_end_dateText
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

Same type as the expression. The expression over the year to date.

Remarks

  • It is CALCULATE ( expression, DATESYTD ( dates ) ), with the filter added when one is given.
  • With three arguments, a text in the third place is read as the year end, not as a filter: TOTALYTD ( [Liters sold], Sales[Month], "6-30" ).
  • The year runs to the last date in the filter context, so on a total row that spans years it shows the last year only.
  • A filter on another column of the same table (a month or a year column next to the dates) stays in place. Where the dates column links a date table to the facts, a filter on it replaces the filters on the rest of that table, so results by year and month name add up as expected.
  • 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

Liters, year to date

EVALUATE
ADDCOLUMNS (
    DATESBETWEEN ( Sales[Month], DATE ( 2025, 1, 1 ), DATE ( 2025, 4, 1 ) ),
    "Liters", [Liters sold],
    "Year to date", TOTALYTD ( [Liters sold], Sales[Month] )
)
ORDER BY Sales[Month]
Sales[Month]LitersYear to date
2025-01-014463544635
2025-02-014483189466
2025-03-0143593133059
2025-04-0144318177377

A season to June, and one product

The season starts again in July; the filter keeps to Pils.

EVALUATE
SUMMARIZECOLUMNS (
    Sales[Month],
    FILTER ( VALUES ( Sales[Month] ), Sales[Month] >= DATE ( 2025, 5, 1 ) && Sales[Month] <= DATE ( 2025, 8, 1 ) ),
    "Liters", [Liters sold],
    "Season to date", TOTALYTD ( [Liters sold], Sales[Month], "6-30" ),
    "Pils, year to date", TOTALYTD ( [Liters sold], Sales[Month], Sales[Product] = "Pils" )
)
ORDER BY Sales[Month]
Sales[Month]LitersSeason to datePils, year to date
2025-05-0149448536988123965
2025-06-0159243596231156760
2025-07-016441964419192520
2025-08-0159266123685224763

By month name, on a related date table

Periods[Month] links Periods to the ledger, so the year to date adds up across the month names.

EVALUATE
CALCULATETABLE (
    ADDCOLUMNS (
        SUMMARIZE ( Periods, Periods[Month name], Periods[Month number] ),
        "Booked", [Booked amount],
        "Year to date", TOTALYTD ( [Booked amount], Periods[Month] )
    ),
    Periods[Year] = 2025,
    Periods[Month number] <= 3,
    Ledger[Scenario] = "Actual"
)
ORDER BY Periods[Month number]
Periods[Month name]Periods[Month number]BookedYear to date
Jan1173711931.53173711931.53
Feb2174582610.98348294542.51
Mar3170760571.54519055114.05

DATESYTD, TOTALQTD, TOTALMTD, CALCULATE, SAMEPERIODLASTYEAR.

Last updated · OpenBI Studio 0.3.74