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.
मित्रांनो! 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.
मित्रों! 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:
- Mark a real Date table (unique date column).
- Relate
Sales[OrderDate]→Date[Date]. Sales YTD = TOTALYTD ( [Total Sales], 'Date'[Date] ).- Twin:
CALCULATE ( [Total Sales], DATESYTD ( 'Date'[Date] ) ). - Matrix with Year/Month — YTD should climb inside the year.
- 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 |
- Why YTD: managers ask for “year so far,” not only March alone.
- On the March row, plain
[Total Sales]shows March only → 80. TOTALYTDexpands the date filter from 1 Jan through the current date context.- Rows in for March YTD: Jan + Feb + Mar. Number out: 220.
- 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.
Time intelligence needs a proper marked Date table related to your facts — Auto date/time is not the serious path.
मित्रांनो — Time intelligence needs a proper marked Date table related to your facts — Auto date/time is not the serious path.
मित्रों — 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?
- Turn off Auto date/time.
- Course: Time intelligence.
Before and after (look at the tables first)
Before
आधी (Before)
पहले (Before)
After
नंतर (After)
बाद में (After)
Date table first
- Import or generate a Date dimension.
- Table tools → Mark as date table.
- One active relationship from the fact date you care about.
- Without this, time intelligence is guesswork.
TOTALYTD
TOTALYTD accumulates a measure from the start of the year through the current date context.
मित्रांनो — TOTALYTD accumulates a measure from the start of the year through the current date context.
मित्रों — TOTALYTD accumulates a measure from the start of the year through the current date context.
Sales YTD =
TOTALYTD (
[Total Sales],
'Date'[Date]
)
- Reads as “Total Sales from year start through current date context”.
- Put Month on rows; watch the cumulative climb.
- Year slicer should restart the story each year.
DATESYTD with CALCULATE
Same idea: CALCULATE ( [Total Sales], DATESYTD ( 'Date'[Date] ) ) — explicit and flexible.
मित्रांनो — Same idea: CALCULATE ( [Total Sales], DATESYTD ( 'Date'[Date] ) ) — explicit and flexible.
मित्रों — Same idea: CALCULATE ( [Total Sales], DATESYTD ( 'Date'[Date] ) ) — explicit and flexible.
Sales YTD Calc =
CALCULATE (
[Total Sales],
DATESYTD ( 'Date'[Date] )
)
- Same business idea as TOTALYTD for many models.
- More explicit when you later add extra filters.
- 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?
Ravindra Bagale's Tip – मराठी
Interview line: “मी marked Date table वापरतो, मग TOTALYTD किंवा CALCULATE with DATESYTD.” जे Date table शिवाय फक्त “YTD function” म्हणतात ते half-ready वाटतात. समजलं का?
Ravindra Bagale's Tip – हिंदी
Interview line: “मैं marked Date table इस्तेमाल करता हूँ, फिर TOTALYTD या CALCULATE with DATESYTD.” जो Date table के बिना सिर्फ “YTD function” कहते हैं वे half-ready लगते हैं. समझ में आया?
Practice task
- Mark Date and relate Sales.
- Write Sales YTD and Sales YTD Calc.
- Matrix: Month + both measures (prove Feb YTD = 140 on a sample like above).
- Confirm they match on a clean model.
- Note what a Year slicer does to the cumulative shape.
Got it? YTD needs a Date table; TOTALYTD and DATESYTD are siblings. Next: MTD and QTD. Let's continue.
समजलं का? YTD needs a Date table; TOTALYTD and DATESYTD are siblings. Next: MTD and QTD. Aata pudhe jaauya.
समझ में आया? YTD needs a Date table; TOTALYTD and DATESYTD are siblings. Next: MTD and QTD. आगे बढ़ते हैं.
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.