All DAX Functions

The TOTALYTD() Function: Master Year-to-Date Calculations

Running totals that reset each calendar year.

On this page

Overview

The TOTALYTD function calculates the year-to-date value of an expression from the start of the calendar year through the current date in context. It is a time intelligence function that requires a proper Date table marked as a date table and an active relationship to your fact data.

It is ideal for cumulative KPIs—revenue YTD, units YTD, budget YTD—where each month or day should show the running total from January 1st forward.

Syntax

DAX Syntax
TOTALYTD(<expression>, <dates> [, <filter>] [, <year_end_date>])
  • <expression>: The measure or expression to accumulate (e.g., SUM(Sales[Revenue])).
  • <dates>: A column of dates from a contiguous Date/Calendar table.
  • <filter> (optional): Additional filters to apply inside the YTD calculation.

Example & Dataset

A Sales fact table linked to a Calendar date dimension (2024):

Sales by Month

MonthRevenue
Jan10000
Feb12000
Mar15000
Apr11000

The DAX Code

First define a base revenue measure, then wrap it in TOTALYTD using the Calendar date column:

Revenue YTD Measure
Total Revenue =
SUM( Sales[Revenue] )

Revenue YTD =
TOTALYTD(
    [Total Revenue],
    Calendar[Date]
)

Expected Output Visual

A line or table visual with Month, [Total Revenue], and [Revenue YTD]:

Output Table Visual

MonthTotal RevenueRevenue YTD
Jan1000010000
Feb1200022000
Mar1500037000
Apr1100048000

Why Did This Output Happen?

TOTALYTD expands the filter context on Calendar to include all dates from January 1 through the last day of the month in the current row. February YTD sums Jan + Feb (22000); March adds March (37000); April adds all four months (48000). Each row shows cumulative revenue from the start of the year, not just that period's sales.