Power Pivot: Calculate Running Total (YTD) with DAX

DAX running total and YTD tutorial showing cumulative calculations date tables and Power Pivot time intelligence
Create running totals and year-to-date calculations in Excel Power Pivot with this practical DAX tutorial. Learn how to use date tables, filter context, cumulative totals, YTD measures, and time intelligence functions to analyze performance over time. Ideal for Excel users, analysts, finance teams, and Power Pivot learners who want to build dynamic reports and track cumulative results accurately.

Year-to-date calculations are the most requested financial metric in every Power Pivot model. DAX provides four distinct approaches to YTD — TOTALYTD, CALCULATE with DATESYTD, fiscal year offsets, and DATESINPERIOD for rolling periods — each suited to a different reporting requirement. Choosing the wrong approach is the most common cause of YTD measures that accumulate across years instead of resetting, or fiscal years that reset on the wrong date. This guide covers each approach with complete copy-paste DAX measures, a comparison table, prior-year comparisons, quarter-to-date, rolling 12-month totals, and dynamic cutoff handling.

Prerequisites — What Must Be in Place Before YTD Works

Two things are required before any YTD measure will work. Both are absolute requirements — the DAX code is correct only when both conditions are met. Without them, TOTALYTD and DATESYTD return blank or aggregate across multiple years without resetting.

Two required prerequisites: 1. A marked Date Table: Power Pivot > Design > Date Table > Mark as Date Table The date column must be selected in the Mark as Date Table dialog. This registers the table as the official calendar dimension. 2. An active relationship to the fact table: In Diagram View, a solid line must connect DateTable[Date] to the date column in each fact table. A dashed line = inactive relationship = TOTALYTD returns blank. Test both with this diagnostic measure: Test := TOTALYTD(COUNTROWS(DateTable), DateTable[Date]) If this returns a number, the Date Table setup is correct. If it returns blank, fix the marking or relationship first.

The Four YTD Approaches Compared

Understanding when to use each approach saves significant debugging time. The choice is not arbitrary — each approach produces meaningfully different results in specific scenarios.

Four YTD approaches and when to use each: Approach 1 — TOTALYTD (shortest syntax): Sales YTD := TOTALYTD([Total Sales], DateTable[Date]) Use when: simple calendar year accumulation, no additional filters needed. Approach 2 — CALCULATE + DATESYTD (most flexible): Sales YTD := CALCULATE([Total Sales], DATESYTD(DateTable[Date])) Use when: combining YTD with additional CALCULATE filters (e.g. Region=East). Approach 3 — Fiscal year DATESYTD with year-end parameter: Sales FY YTD := CALCULATE([Total Sales], DATESYTD(DateTable[Date],"3-31")) Use when: fiscal year does not start on January 1. Approach 4 — DATESINPERIOD for rolling periods: Sales R12M := CALCULATE([Total Sales], DATESINPERIOD(DateTable[Date], LASTDATE(DateTable[Date]), -12, MONTH)) Use when: rolling window that does not reset at year boundaries.

Example 1: Standard Calendar YTD — TOTALYTD

TOTALYTD is the simplest YTD measure. It accumulates the base measure from January 1 to the current date context. In a PivotTable with Year and Month from the Date Table in the rows, the value increases each month and resets automatically at the start of each calendar year. The reset happens because the Year field in the PivotTable creates a separate filter context for each year — TOTALYTD sees only dates within the currently filtered year.

Standard calendar YTD: Sales YTD := TOTALYTD([Total Sales], DateTable[Date]) Equivalent CALCULATE form (same result — use this when adding extra filters): Sales YTD := CALCULATE([Total Sales], DATESYTD(DateTable[Date])) Jan 2025: £48,100 YTD: £48,100 Feb 2025: £44,200 YTD: £92,300 Mar 2025: £61,800 YTD: £154,100 Jan 2026: £52,400 YTD resets: £52,400 (new calendar year)

Example 2: Fiscal Year YTD — DATESYTD with Year-End Parameter

Many organisations run on a fiscal year that starts on a date other than January 1. DATESYTD accepts an optional year-end date string that controls where the annual reset falls. Specifying "3-31" tells DAX the fiscal year ends on March 31, so accumulation resets on April 1 each year. This is one of the most commonly requested customisations in Power Pivot financial models — the single parameter change is sufficient without any modification to the Date Table structure.

Fiscal year YTD: Sales FY YTD := CALCULATE([Total Sales], DATESYTD(DateTable[Date], "3-31")) Common year-end parameters: April 1 start → "3-31" (UK financial year) July 1 start → "6-30" (many US companies) October 1 start → "9-30" (US federal government fiscal year)

Example 3: Prior Year YTD — Cumulative Comparison

Combining TOTALYTD with SAMEPERIODLASTYEAR creates a prior-year YTD comparison. This shows cumulative sales this year versus the same cumulative period last year. The YoY growth percentage then indicates whether the year-to-date trend is improving or deteriorating versus the equivalent prior-year period. This pattern is standard in board packs, investor reporting, and any management dashboard that tracks annual performance trajectory.

Prior year YTD comparison measures: Sales YTD := TOTALYTD([Total Sales], DateTable[Date]) Sales YTD PY := CALCULATE([Sales YTD], SAMEPERIODLASTYEAR(DateTable[Date])) YTD YoY % := DIVIDE([Sales YTD] - [Sales YTD PY], [Sales YTD PY], 0) Jan 2025: £48,100 vs PY £42,300 = +13.7% YoY Feb 2025: £92,300 vs PY £81,000 = +13.9% YoY (YTD basis)

Example 4: Quarter-to-Date — QTD Accumulation

TOTALQTD accumulates from the start of the current quarter. It resets at the beginning of each quarter rather than each year — exactly the right metric for quarterly performance reporting and board presentations that focus on the current-quarter progress without the full year's accumulation. The prior-quarter comparison pattern follows the same structure as the prior-year comparison: use SAMEPERIODLASTYEAR with a quarter offset, or use DATEADD with -1 QUARTER.

Quarter-to-date measure: Sales QTD := TOTALQTD([Total Sales], DateTable[Date]) Jan 2025: £48,100 QTD: £48,100 (start of Q1) Mar 2025: £61,800 QTD: £154,100 (end of Q1) Apr 2025: £61,200 QTD resets: £61,200 (start of Q2) Prior quarter comparison: Sales QTD PQ := CALCULATE([Sales QTD], DATEADD(DateTable[Date], -1, QUARTER))

Example 5: Rolling 12-Month — Moving Annual Total

A rolling 12-month total sums the last 12 calendar months regardless of the year boundary. Unlike YTD, which resets each January 1, the rolling total moves continuously forward — always showing the most recent 12 months from the current date context. This is the correct metric for annualised KPIs and run-rate projections where a year-end reset would artificially deflate the number for early calendar-year periods. DATESINPERIOD generates the correct dynamic date window for each cell in the PivotTable.

Rolling 12-month total: Sales R12M := CALCULATE( [Total Sales], DATESINPERIOD(DateTable[Date], LASTDATE(DateTable[Date]), -12, MONTH) ) Jan 2025: sums Feb 2024 – Jan 2025 Feb 2025: sums Mar 2024 – Feb 2025 (window shifts forward 1 month)

Example 6: Dynamic YTD — Handle Data Cutoff Dates

In live models, data is only available through a specific cutoff date. A dynamic YTD measure returns BLANK() for future periods rather than showing zero — preventing the common problem where the current partial month appears misleadingly low because not all transactions have yet been recorded. This approach also handles the last-data-date boundary correctly for any month-in-progress, making the measure safe for live dashboards that refresh daily or weekly.

Dynamic YTD with data cutoff handling: LastDataDate := MAX(FactTable[OrderDate]) Sales YTD Dynamic := IF( MIN(DateTable[Date]) <= [LastDataDate], CALCULATE([Total Sales], DATESYTD(DateTable[Date])), BLANK() ) Jan 2025: shows YTD correctly (data exists) Apr 2025: shows BLANK (future — no data available yet) Current month (partial): shows YTD through latest available transaction date

Troubleshooting YTD Measures

All three issues below stem from the same root cause: the Date Table is not properly set up. Fixing the Date Table setup resolves all three problems simultaneously.

TOTALYTD returns blank in every period

Blank YTD results almost always mean either the Date Table is not marked or the relationship to the fact table is missing. Check both in Power Pivot. First, go to Design > Date Table > Mark as Date Table and verify the date column is selected. Second, open Diagram View and confirm a solid line connects DateTable[Date] to the fact table. A dashed line indicates an inactive relationship — right-click it and choose "Mark as Active". Run the diagnostic measure TOTALYTD(COUNTROWS(DateTable), DateTable[Date]) to confirm the setup is correct before adding business logic.

The YTD does not reset at the start of a new year

This happens when the PivotTable row area contains only a Month field without a Year field above it. TOTALYTD resets when the Year filter context changes. If only Month is in the rows — without Year — months from different years share the same filter context and YTD accumulates across year boundaries without resetting. Fix this by adding the Year field from the Date Table above the Month field in the PivotTable row area. The Year field must come from the Date Table, not from the fact table.

The fiscal year YTD resets on the wrong date

The year-end parameter in DATESYTD is a string in month-day format ("3-31", not "31-3"). A common mistake is reversing the order to "31-3" or "31/03", which causes a formula error or incorrect reset. Always write the parameter as month number hyphen day number: "3-31" for March 31, "6-30" for June 30, "9-30" for September 30. Also verify the parameter value matches the last day of the fiscal year, not the first day of the new fiscal year — the parameter specifies where the year ends, not where it begins.

Frequently Asked Questions

  • How do I calculate YTD in Power Pivot using DAX?+
    Use TOTALYTD([Your Measure], DateTable[Date]) in a calculated measure. This requires two prerequisites: a marked Date Table (Design > Date Table > Mark as Date Table) and an active relationship between the Date Table and your fact table's date column. The measure accumulates from January 1 to the current date context in each PivotTable cell. Place Year and Month from the Date Table in the PivotTable row area to see YTD values by month with the correct annual reset at each January.
  • What is the difference between TOTALYTD and DATESYTD?+
    TOTALYTD is a shorthand function that accepts the base measure directly as its first argument. DATESYTD is a table function used inside CALCULATE. Both produce the same YTD result for a standard calendar year. DATESYTD is more flexible because it combines with additional CALCULATE filter arguments. For example, CALCULATE([Sales], DATESYTD(DateTable[Date]), Region="North") calculates North region YTD only — you cannot add this second filter argument with TOTALYTD alone.
  • How do I calculate fiscal year YTD in Power Pivot?+
    Use DATESYTD with the year-end parameter: CALCULATE([Total Sales], DATESYTD(DateTable[Date], "3-31")). The string "3-31" tells DAX the fiscal year ends on March 31, so the accumulation resets on April 1 each year. The parameter format is always month-day (not day-month): "3-31" for April start, "6-30" for July start, "9-30" for October start. The standard Date Table works for all fiscal calendars — no structural changes to the Date Table are required.
  • What is the difference between YTD and a rolling 12-month total?+
    YTD accumulates from January 1 to the current date and resets at the start of each calendar year — so February 2025 YTD covers 2 months, and December 2025 YTD covers 12 months. A rolling 12-month total always covers the most recent 12 calendar months regardless of year boundaries — so February 2025 rolling 12M covers March 2024 to February 2025. Use YTD for annual performance tracking and budget vs actual comparisons. Use rolling 12-month for run-rate analysis, annualised KPIs, and trend analysis that should not reset at year-end.