Going DeeperPro· 45 min read

Time Intelligence: YTD, YoY & Period Comparisons

Year-to-date, last year, and growth — the period comparisons every business report needs, in a few DAX lines.

What you will learn

  • Build a year-to-date (YTD) measure
  • Compare a period with the same period last year
  • Calculate year-over-year growth as a percentage

The questions every manager asks

Almost every real report answers time questions: *How are we doing so far this year? Are we up on last year? Did this month beat the same month a year ago?* DAX has a family of time-intelligence functions built exactly for these — but they only work when you have a proper Date table (from the star-schema lesson) marked as the date table.

Watch out: Time intelligence needs a real Date table with one row per day, connected to your fact’s date and marked as a date table (Modeling → Mark as date table). Without it, these functions return wrong or blank results — this is the most common time-intelligence mistake.

Year-to-date (YTD): the running total this year

Year-to-date means “everything from January 1st up to the current point”. If you are looking at March, YTD sales = January + February + March added together. The function TOTALYTD does this for you:

TOTALYTD accumulates sales from the start of the year to the current date
Sales YTD =
TOTALYTD(
    SUM(Sales[Amount]),
    Dates[Date]
)

Note: Output: In a table by month, if Jan = 4,000, Feb = 5,200 and Mar = 6,800, then Sales YTD shows 4,000 for Jan, 9,200 for Feb (4,000+5,200) and 16,000 for Mar (4,000+5,200+6,800). The running total resets to 0 each January 1st. TOTALYTD walks the Date table to know what “so far this year” means.

Same period last year

To compare against history, you shift the dates back exactly one year with SAMEPERIODLASTYEAR, wrapped in CALCULATE so it changes the filter context:

Pull the same period’s sales from one year earlier
Sales Last Year =
CALCULATE(
    SUM(Sales[Amount]),
    SAMEPERIODLASTYEAR(Dates[Date])
)

Note: Output: For March 2026, this returns the total for March 2025. Place it beside this year’s March total in a table and you can read the two years side by side for every month. SAMEPERIODLASTYEAR simply slides the current date filter back 365-ish days (it handles leap years for you).

Year-over-year (YoY) growth

Year-over-year growth is the headline number leaders love: *how much higher (or lower) are we than the same time last year, as a percentage?* You build it from the two measures above:

This year minus last year, divided by last year
YoY Growth % =
DIVIDE(
    SUM(Sales[Amount]) - [Sales Last Year],
    [Sales Last Year]
)

Note: Output: If March 2026 made 6,800 and March 2025 made 5,000, then (6,800 − 5,000) / 5,000 = 0.36, shown as +36% once formatted as a percentage. A positive number means growth, a negative number means decline. DIVIDE keeps it safe: if last year was 0 or blank, you get a blank instead of an error.

A few more you will reach for

FunctionAnswersReads as
TOTALYTDTotal so far this yearYear-to-date running total
TOTALMTDTotal so far this monthMonth-to-date running total
SAMEPERIODLASTYEARThe matching period a year agoShift the dates back one year
DATEADDAny shift you chooseMove the dates by N days/months/years
PREVIOUSMONTHThe whole prior monthLast month’s total

A worked dashboard line might read: This month 7,500 · Last month 6,800 · vs last year +12% · YTD 41,000 — four time measures, each one or two DAX lines, all powered by the same Date table.

Tip: Build time measures in layers: first a base Total Sales, then Sales Last Year on top of it, then YoY Growth % on top of both. Re-using measures inside other measures keeps each line short and easy to fix.

Q. Which function gives a running total from January 1st up to the current date in view?

Answer: TOTALYTD accumulates a value from the start of the year to the current date (year-to-date). SAMEPERIODLASTYEAR shifts to a year ago; the others do not handle dates.

✍️ Practice

  1. Add a Sales YTD measure with TOTALYTD and view it in a table by month.
  2. Add Sales Last Year and place this year and last year side by side for each month.

🏠 Homework

  1. Build a YoY Growth % measure, format it as a percentage, and write one sentence interpreting whether the business is growing.
Want to learn this with a mentor?

CodingClave runs guided, project-based training (28-day, 45-day & 6-month batches).

Explore Training →