Ravindra BagaleCourses & study guides Track your progress

Guides

Year-to-Date in DAX: TOTALYTD and DATESYTD

TOTALYTD and CALCULATE + DATESYTD both build year-to-date totals in DAX — they need a marked Date table related to your facts, not Auto date/time shortcuts.

Friends! YTD is the first time-intelligence win that managers recognise. Why? “How are we doing this year so far?” is a weekly question. How? We mark a Date table, write TOTALYTD, then the DATESYTD twin, on fictional FreshBasket sales. Longer page — foundation for MTD, QTD and YoY.

Quick answer

Vertical setup:

  1. Mark a real Date table (unique date column).
  2. Relate Sales[OrderDate] → Date[Date].
  3. Sales YTD = TOTALYTD ( [Total Sales], 'Date'[Date] ).
  4. Twin: CALCULATE ( [Total Sales], DATESYTD ( 'Date'[Date] ) ).
  5. Matrix with Year/Month — YTD should climb inside the year.
  6. Disable Auto date/time if it still fights you.
TOTALYTD ( [Total Sales], 'Date'[Date] )
CALCULATE ( [Total Sales], DATESYTD ( 'Date'[Date] ) )

Why YTD, rows in / number out

Imagine 2026 Mumbai sales by month:

Month Amount
Jan 100
Feb 40
Mar 80
  1. Why YTD: managers ask for “year so far,” not only March alone.
  2. On the March row, plain [Total Sales] shows March only → 80.
  3. TOTALYTD expands the date filter from 1 Jan through the current date context.
  4. Rows in for March YTD: Jan + Feb + Mar. Number out: 220.
  5. On the Feb row, YTD is 140 (100 + 40). That matches our favourite “Mumbai 140” shape.

Without a marked Date table, time intelligence is guesswork.

YTD needs a Date table Mark a real Date table and relate facts before time intelligence. Date tablemarked Sales[OrderDate]→ Date[Date] model

Time intelligence needs a proper marked Date table related to your facts — Auto date/time is not the serious path.

What do I need before this guide?

Before and after (look at the tables first)

Before YTD Monthly amounts; March alone is 100.

Before

After TOTALYTD Year-to-date running totals end at 190.

After

Date table first

  1. Import or generate a Date dimension.
  2. Table tools → Mark as date table.
  3. One active relationship from the fact date you care about.
  4. Without this, time intelligence is guesswork.

TOTALYTD

TOTALYTD TOTALYTD accumulates the measure from year start to the current date context. Jan … TOTALYTDto date YTD ytd

TOTALYTD accumulates a measure from the start of the year through the current date context.

Sales YTD =
TOTALYTD (
    [Total Sales],
    'Date'[Date]
)
  1. Reads as “Total Sales from year start through current date context”.
  2. Put Month on rows; watch the cumulative climb.
  3. Year slicer should restart the story each year.

DATESYTD with CALCULATE

DATESYTD with CALCULATE CALCULATE + DATESYTD is the same idea as TOTALYTD. CALCULATE DATESYTD ( Date ) YTD datesytd

Same idea: CALCULATE ( [Total Sales], DATESYTD ( 'Date'[Date] ) ) — explicit and flexible.

Sales YTD Calc =
CALCULATE (
    [Total Sales],
    DATESYTD ( 'Date'[Date] )
)
  1. Same business idea as TOTALYTD for many models.
  2. More explicit when you later add extra filters.
  3. Learn both so course examples never surprise you.

Shop analogy: YTD is the running till from 1 January to today. March’s own sales are only today’s drawer for that month.

Mistakes and calm fixes

Symptom Likely cause Fix
Blank YTD No mark / wrong relationship Mark date table; fix relationship
Weird double counts Auto date/time still on Disable; use Date table fields
Flat line Visual not using Date[Date] Use Date dimension on axis
Fiscal chaos Calendar YTD expected Learn fiscal argument after calendar works

Ghabru naka 😅 — fix the Date table before rewriting the measure five times.

Ravindra Bagale's Tip

Interview line: “I use a marked Date table, then TOTALYTD or CALCULATE with DATESYTD.” Students who only say “YTD function” without the Date table sound half-ready. Got it?

Practice task

  1. Mark Date and relate Sales.
  2. Write Sales YTD and Sales YTD Calc.
  3. Matrix: Month + both measures (prove Feb YTD = 140 on a sample like above).
  4. Confirm they match on a clean model.
  5. Note what a Year slicer does to the cumulative shape.

Learn it properly

Course lessons:

Related guides: MTD / QTD · Auto date/time

Got it? YTD needs a Date table; TOTALYTD and DATESYTD are siblings. Next: MTD and QTD. Let's continue.

Frequently asked questions

What is TOTALYTD?

A time intelligence function that evaluates an expression as a year-to-date total over a dates column.

TOTALYTD vs DATESYTD?

TOTALYTD is convenient sugar; CALCULATE + DATESYTD is the same idea with more visible control.

Why do I need a Date table?

Time intelligence expects a continuous date column in a proper date dimension — not random fact dates alone.

Fiscal year?

TOTALYTD accepts an optional year-end date string for fiscal calendars — learn after calendar YTD works.

YTD blank?

Check relationship, mark as date table, and that the visual’s date filter is on the Date table.

Course lesson?

Time intelligence in the DAX chapter.