How to Use TOTALYTD Function in Power BI

Power BI DAX

TOTALYTD Function

The DAX TOTALYTD function calculates the year‑to‑date (YTD) total of a measure, accumulating values from the beginning of the year up to the last date in the current filter context. It is the standard way to compute YTD in Power BI.

Core idea: TOTALYTD sums a measure from the first day of the year (or a specified fiscal year start) to the current date in context, making it essential for cumulative annual performance tracking.

1. What is TOTALYTD?

TOTALYTD evaluates a measure over the period from the start of the year (or fiscal year) to the last date in the current filter context. It is a time‑intelligence function that simplifies YTD calculations.

Context (current date)TOTALYTD returns
March 15, 2026Sum from Jan 1, 2026 to Mar 15, 2026
December 31, 2026Sum from Jan 1, 2026 to Dec 31, 2026 (full year)
June 30, 2026 (fiscal year starts Jul 1)Sum from Jul 1, 2025 to Jun 30, 2026
Inclusive: the range includes the start of the year and the current date.

2. Syntax

TOTALYTD(<expression>, <dates>, [<filter>], [<year_end_date>])
ArgumentDescriptionExample
<expression>The measure to aggregate (e.g., SUM).[Total Sales]
<dates>A date column (usually from Date table).'Date'[Date]
<filter> (optional)Additional filter to apply.ALL('Product')
<year_end_date> (optional)End of fiscal year (e.g., “6-30”)."6-30"

The year_end_date parameter is a string in "MM-DD" format.

3. How TOTALYTD Works

It takes the current filter context, finds the latest date in that context, and sums the expression from the first day of that year (or fiscal year) up to that date.

Current filter context: March 2026 (e.g., 2026-03-15)
        ↓
TOTALYTD([Total Sales], 'Date'[Date])
        ↓
Evaluates: SUM of [Total Sales] from 2026-01-01 to 2026-03-15
        ↓
Returns: YTD Sales = $340,000

The function uses the last date in the current context. If the context is a month (March 2026), it uses March 31, 2026 as the end date.

4. Date Table & Context

For reliable results, use a continuous Date table with no gaps. TOTALYTD relies on the date column to determine the year boundaries and the current date.

Caution: If your date column has gaps, TOTALYTD may not include all expected dates, leading to incorrect YTD totals.

5. Basic Examples

Standard YTD Sales

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

YTD Sales with fiscal year ending June 30

YTD Sales Fiscal = TOTALYTD([Total Sales], 'Date'[Date],, "6-30")

YTD Sales with additional filter

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

6. Three Real‑World Examples

Example 1: Retail YTD Sales

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

If the current context is March 31, 2026, this returns sales from January 1 to March 31, 2026.

Example 2: Fiscal YTD (April–March fiscal year)

YTD Sales Fiscal = TOTALYTD([Total Sales], 'Date'[Date],, "3-31")

If the current context is December 2026, this returns sales from April 1, 2026 to December 31, 2026.

Example 3: YTD Profit

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

7. YTD Sales – with Example Table

Consider monthly sales data for 2026:

MonthMonthly SalesYTD Sales (TOTALYTD)
January100,000100,000
February120,000220,000
March110,000330,000
April130,000460,000
May140,000600,000
June125,000725,000
July150,000875,000
August160,0001,035,000
September145,0001,180,000
October155,0001,335,000
November170,0001,505,000
December180,0001,685,000

Formula used:

YTD Sales = TOTALYTD([Monthly Sales], 'Date'[Date])
Result: The YTD Sales column shows the cumulative total from January through the current month.

8. Fiscal Year YTD (July–June)

For a fiscal year ending June 30, use the year_end_date parameter:

YTD Sales Fiscal = TOTALYTD([Monthly Sales], 'Date'[Date],, "6-30")
MonthMonthly SalesFiscal YTD (Jul–Jun)
July 202590,00090,000
August 202595,000185,000
September 2025100,000285,000
October 2025105,000390,000
November 2025110,000500,000
December 2025115,000615,000
January 2026120,000735,000
February 2026125,000860,000
March 2026130,000990,000
April 2026135,0001,125,000
May 2026140,0001,265,000
June 2026145,0001,410,000

Result: Fiscal YTD resets every July 1.

9. YTD in a Matrix / Table

When placed in a matrix with Year and Month on rows, TOTALYTD automatically calculates the cumulative total for each year.

YearMonthMonthly SalesYTD Sales
2025Jan80,00080,000
2025Feb85,000165,000
2025Mar90,000255,000
2026Jan100,000100,000
2026Feb120,000220,000
2026Mar110,000330,000
Note: TOTALYTD resets at the beginning of each year (or fiscal year).

10. YTD in a Line Chart

When you place YTD Sales on a line chart with Month on the X‑axis, you see a cumulative line that climbs throughout the year and resets each January.

MonthMonthly SalesYTD Sales (line chart value)
Jan100k100k
Feb120k220k
Mar110k330k
Apr130k460k
May140k600k
Jun125k725k

This visual is excellent for tracking annual progress.

11. YTD vs Previous Year YTD

Compare current YTD with the same period last year:

YTD Sales Prior Year =
VAR CurrentYTD = TOTALYTD([Total Sales], 'Date'[Date])
VAR PriorYearYTD =
    CALCULATE(
        [Total Sales],
        DATESYTD(SAMEPERIODLASTYEAR('Date'[Date]))
    )
RETURN PriorYearYTD

Or use the simpler TOTALYTD with SAMEPERIODLASTYEAR:

YTD Sales LY =
TOTALYTD(
    [Total Sales],
    SAMEPERIODLASTYEAR('Date'[Date])
)
MonthYTD Sales 2026YTD Sales 2025 (LY)
Jan100,00080,000
Feb220,000165,000
Mar330,000255,000

12. TOTALYTD vs CALCULATE + DATESYTD

TOTALYTD is a convenience function that wraps CALCULATE and DATESYTD.

-- These are equivalent:
TOTALYTD([Total Sales], 'Date'[Date])
CALCULATE([Total Sales], DATESYTD('Date'[Date]))

Use TOTALYTD for simplicity and readability.

13. Filter Context & Visual Behavior

TOTALYTD respects the current filter context. If a visual is filtered to a specific date range, YTD is calculated within that context.

Powerful: You write the measure once, and Power BI automatically calculates YTD for each row in the visual.

14. TOTALYTD vs Related Functions

FunctionPurposeWhen to use
TOTALYTDYear‑to‑date totalStandard YTD
DATESYTDReturns YTD date tableInside CALCULATE for custom YTD
TOTALQTDQuarter‑to‑date totalQTD analysis
TOTALMTDMonth‑to‑date totalMTD analysis
DATESINPERIODInterval from a base dateRolling windows

15. Common Mistakes

  • Using a transaction date column: gaps in the date column lead to missing dates in the YTD calculation.
  • Forgetting the fiscal year parameter: if your fiscal year doesn’t start in January, you must specify year_end_date.
  • Ignoring relationships: the Date table must be related to the fact table.
  • Not handling incomplete periods: comparing YTD for a partial month with a full month can be misleading.
  • Confusing with TOTALQTD or TOTALMTD: YTD is year‑to‑date, not quarter or month.

16. Performance & Best Practices

  • Use a continuous Date table marked as a date table.
  • Use TOTALYTD for simple, readable YTD measures.
  • Specify the year_end_date parameter for fiscal years.
  • Use VAR for complex YTD calculations (e.g., YoY YTD comparisons).
  • Test with incomplete periods to avoid misleading visualisations.

17. Practical Patterns

Standard YTD

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

Fiscal YTD (ends June 30)

YTD Sales Fiscal = TOTALYTD([Total Sales], 'Date'[Date],, "6-30")

YTD with filter (e.g., Online channel)

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

YTD vs Previous Year YTD

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

YoY YTD Growth %

YoY YTD % =
VAR Current = TOTALYTD([Total Sales], 'Date'[Date])
VAR Prior = TOTALYTD([Total Sales], SAMEPERIODLASTYEAR('Date'[Date]))
RETURN DIVIDE(Current - Prior, Prior)

18. Simple Mental Model

Current date context (e.g., March 2026)
        ↓
TOTALYTD([Measure], 'Date'[Date])
        ↓
Finds the last date in context (March 31, 2026)
        ↓
Sums [Measure] from Jan 1, 2026 to March 31, 2026
        ↓
Returns: YTD total

19. Quick Reference

ScenarioDAX
Standard YTDTOTALYTD([Total Sales], 'Date'[Date])
Fiscal YTD (ends June 30)TOTALYTD([Total Sales], 'Date'[Date],, "6-30")
YTD with filterTOTALYTD([Total Sales], 'Date'[Date], 'Sales'[Channel] = "Online")
YTD Previous YearTOTALYTD([Total Sales], SAMEPERIODLASTYEAR('Date'[Date]))
YoY YTD Growth %VAR C=TOTALYTD([Sales],'Date'[Date]) VAR P=TOTALYTD([Sales],SAMEPERIODLASTYEAR('Date'[Date])) RETURN DIVIDE(C-P,P)

20. Final Summary

TOTALYTD is the standard and most convenient function for year‑to‑date calculations in Power BI. It accumulates a measure from the beginning of the year (or fiscal year) to the current date in context.

4 args
Expression, dates, filter, year end
Cumulative
Resets each year
  • Use TOTALYTD for simple, readable YTD measures.
  • Specify year_end_date for fiscal years.
  • Combine with SAMEPERIODLASTYEAR for YoY YTD comparisons.
  • A proper Date table is essential for reliable results.
  • It is equivalent to CALCULATE([Measure], DATESYTD('Date'[Date])).
One‑line definition: TOTALYTD calculates the cumulative total of a measure from the start of the year (or fiscal year) to the current date in context.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top