Skip to content

Chapter 4 of 6

Time Intelligence and Date Tables

Time intelligence in DAX enables period-over-period analysis using functions such as TOTALYTD, TOTALMTD, TOTALQTD, SAMEPERIODLASTYEAR, DATEADD, PARALLELPERIOD, PREVIOUSMONTH, and the DATES* family. Each of these requires a properly marked date table containing a continuous date column. Without marking, functions like TOTALYTD may produce incorrect results because the engine cannot identify the calendar backbone of the model. The Power BI auto-date feature creates hidden date tables for each date column but increases model size, so it is generally recommended to disable auto-date and build an explicit date table using CALENDAR, CALENDARAUTO, or GENERATESERIES.

TOTALYTD evaluates an expression from the start of the calendar year up to the latest date in the current filter context, optionally allowing a fiscal year-end date. DATESYTD is the underlying table function, returning a single-column table of dates from the year to date, and is typically wrapped inside CALCULATE. TOTALMTD and DATESMTD perform the same role for month-to-date calculations, while TOTALQTD and DATESQTD handle quarter-to-date scenarios. DATESBETWEEN provides more flexibility by returning dates between any specified start and end, useful for custom periods not aligned with the calendar. OPENINGBALANCEMONTH and CLOSINGBALANCEQUARTER evaluate expressions at the start or end of a period, supporting stock or inventory measures that need snapshots.

For comparing periods, SAMEPERIODLASTYEAR shifts the current date selection back by exactly one year and is the simplest year-over-year tool. DATEADD shifts a date column by a specified number of intervals (days, months, quarters, or years) and is more flexible, while PARALLELPERIOD returns a contiguous range at a specified grain and supports fiscal year shifts. The difference between SAMEPERIODLASTYEAR and DATEADD lies in how they handle non-contiguous selections: SAMEPERIODLASTYEAR shifts every date individually, whereas DATEADD treats the current selection as a unit. Choosing the right function depends on whether the underlying selection represents a single contiguous period or a custom range of dates.

All chapters
  1. 1Foundations of DAX and Calculation Types
  2. 2CALCULATE and Filter Manipulation
  3. 3Iterator, Aggregation, and Lookup Functions
  4. 4Time Intelligence and Date Tables
  5. 5Data Modeling, Relationships, and Schemas
  6. 6Performance, Storage Modes, and Security

Drill it

Reading is not remembering. These come from the Power Bi Dax Fundamentals deck:

Q

What is a DAX measure?

A calculated formula created using DAX that is evaluated at query time based on filter context. Measures return dynamic values depending on the filters applied...

Q

How does filter context work in DAX?

Filter context is the set of filters applied to a calculation, generated by slicers, visuals, page-level filters, or row-level security. It determines which row...

Q

What does the CALCULATE function do?

CALCULATE evaluates an expression in a modified filter context. It can add, replace, or remove filters on specified columns, overriding the existing filter cont...

Q

What is the syntax for CALCULATE?

CALCULATE(, , , ...). The expression is evaluated after applying all listed filter arguments, which can be boolean expressions, table expressions, or KEEPFILTER...