WMA Hub

Tools / DAX library

Year-to-date total

Accumulate a measure from 1 January up to the date in the current context.

Running totals · Beginner · Not yet reviewed

Sales YTD =
TOTALYTD([Total Sales], 'Date'[Date])

How it works

TOTALYTD evaluates [Total Sales] over all dates from the start of the year up to the last date in the current filter context. On a monthly visual, March shows January + February + March.

The same result can be written with CALCULATE([Total Sales], DATESYTD('Date'[Date])).

What your model needs

- A date table named 'Date' with one row per day and no gaps, marked as the date table in Power BI (Table tools > Mark as date table). - A one-to-many relationship from 'Date'[Date] to the date column of the Sales table (for example Sales[OrderDate]). - Total Sales = SUM(Sales[Amount]) (called [Total Sales]).

Small example

Input data

Month | Total Sales
Jan | 100
Feb | 150
Mar | 120

Expected result

Month | Sales YTD
Jan | 100
Feb | 250
Mar | 370

Common mistakes and limitations

- This is a calendar-year total. For a fiscal year that does not start in January, see the fiscal year-to-date formula. - Without a marked, gap-free date table the totals can be wrong.

Tags: YTD, TOTALYTD, running total