Time Intelligence

Learn how DAX Time Intelligence functions perform year-to-date calculations, period comparisons, running totals, and trend analysis in Power BI.

Time Intelligence

Time Intelligence is a collection of DAX functions that simplify calculations involving dates.

Instead of writing complex formulas to compare months, quarters, or years, DAX provides built-in functions that automatically understand time periods.

Time Intelligence is commonly used to calculate:

  • Year-to-Date (YTD) Sales
  • Month-to-Date (MTD) Sales
  • Quarter-to-Date (QTD) Sales
  • Previous Year Sales
  • Year-over-Year Growth
  • Running Totals
  • Rolling 12-Month Averages

These calculations are fundamental to business reporting and executive dashboards.


Why Time Intelligence Matters

Business users rarely want to see only today's numbers.

Instead, they ask questions such as:

  • How much have we sold this year?
  • How does this month compare to last month?
  • Are sales increasing over time?
  • What was revenue last year?
  • What is our Year-over-Year growth?

Time Intelligence functions answer these questions with relatively simple DAX.


Date Table Requirements

Time Intelligence requires a proper Date table.

A typical model looks like:

              DimDate
                 |
                 |
FactSales -------+

The Date table should contain one row for every date.

Typical columns include:

ColumnPurpose
DateCalendar date
YearReporting year
QuarterCalendar quarter
MonthMonth name
Month NumberSort order
WeekWeek number

The Date table should span the entire reporting period—even if there are no sales on some dates.


Mark as Date Table

Power BI requires a dedicated Date table for many Time Intelligence functions.

To mark a table as a Date table:

  1. Select the Date table.
  2. Open the Table Tools ribbon.
  3. Choose Mark as Date Table.
  4. Select the Date column.

This allows DAX to correctly interpret calendar periods.


Basic Date Model

A common star schema looks like this:

              DimDate
                 |
                 |
DimCustomer --- FactSales --- DimProduct
                 |
                 |
              DimStore

The FactSales table stores transactions.

The DimDate table provides the calendar used for reporting.

Almost every Time Intelligence calculation depends on this relationship.


First Time Intelligence Measure

Suppose you already have a basic measure:

Total Sales =
SUM(FactSales[SalesAmount])

This returns sales for the current filter context.

To calculate sales for the current year, DAX provides specialized Time Intelligence functions that build on this measure.

You'll learn those functions next.


Year-to-Date (YTD)

Year-to-Date (YTD) calculates the cumulative value from the beginning of the year through the current date.

The TOTALYTD() function makes this calculation simple.

Example:

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

As new dates are selected, the measure automatically accumulates sales from January 1 through the current date.

Example:

MonthMonthly SalesSales YTD
January$50,000$50,000
February$60,000$110,000
March$45,000$155,000

Month-to-Date (MTD)

Month-to-Date (MTD) calculates the cumulative value from the beginning of the current month.

Example:

Sales MTD =
TOTALMTD(
    [Total Sales],
    DimDate[Date]
)

This measure resets automatically at the beginning of each new month.


Quarter-to-Date (QTD)

Quarter-to-Date (QTD) accumulates values from the start of the current quarter.

Example:

Sales QTD =
TOTALQTD(
    [Total Sales],
    DimDate[Date]
)

This is commonly used in financial reporting and quarterly performance dashboards.


Previous Year Sales

Comparing current performance to the previous year is one of the most common business requirements.

The SAMEPERIODLASTYEAR() function returns the equivalent period from the previous year.

Example:

Sales Last Year =
CALCULATE(
    [Total Sales],
    SAMEPERIODLASTYEAR(DimDate[Date])
)

If the current report shows:

March 2026

the measure automatically evaluates:

March 2025


Comparing Different Time Periods

The DATEADD() function shifts the current filter by a specified interval.

Example:

Sales Previous Month =
CALCULATE(
    [Total Sales],
    DATEADD(
        DimDate[Date],
        -1,
        MONTH
    )
)

Other examples include:

-1 MONTH   Previous Month

-1 QUARTER Previous Quarter

-1 YEAR    Previous Year

This makes it easy to compare current performance with earlier periods.


DATESYTD()

Unlike TOTALYTD(), which returns a cumulative value, DATESYTD() returns a table of dates from the beginning of the year to the current date.

It is often used inside CALCULATE().

Example:

Sales YTD =
CALCULATE(
    [Total Sales],
    DATESYTD(DimDate[Date])
)

Both approaches produce a Year-to-Date calculation, but DATESYTD() provides greater flexibility when building advanced measures.


Choosing the Right Function

RequirementFunction
Year-to-DateTOTALYTD()
Month-to-DateTOTALMTD()
Quarter-to-DateTOTALQTD()
Previous YearSAMEPERIODLASTYEAR()
Shift DatesDATEADD()
Custom YTD FiltersDATESYTD()

These functions cover most of the Time Intelligence calculations used in business reporting.


Running Totals

A running total accumulates values over time.

Instead of displaying sales for each individual period, a running total continuously adds each period to the previous one.

Example:

Running Sales =
CALCULATE(
    [Total Sales],
    FILTER(
        ALL(DimDate[Date]),
        DimDate[Date] <= MAX(DimDate[Date])
    )
)

Example output:

MonthMonthly SalesRunning Total
January$50,000$50,000
February$60,000$110,000
March$45,000$155,000
April$70,000$225,000

Running totals are commonly used for revenue, production, inventory, and cumulative KPI dashboards.


Rolling 12-Month Sales

Rolling calculations smooth short-term fluctuations by evaluating the previous 12 months instead of a single period.

Example:

Rolling 12 Months =
CALCULATE(
    [Total Sales],
    DATESINPERIOD(
        DimDate[Date],
        MAX(DimDate[Date]),
        -12,
        MONTH
    )
)

Rolling periods are frequently used for:

  • Sales trends
  • Forecasting
  • Financial reporting
  • Manufacturing performance

Year-over-Year (YoY) Growth

Year-over-Year compares the current period with the same period from the previous year.

Example:

Sales YoY % =
DIVIDE(
    [Total Sales] - [Sales Last Year],
    [Sales Last Year]
)

Example results:

YearSalesYoY Growth
2025$500,000
2026$575,00015%

YoY comparisons help identify long-term business growth.


Month-over-Month (MoM) Growth

Month-over-Month compares the current month to the previous month.

Example:

Sales Previous Month =
CALCULATE(
    [Total Sales],
    DATEADD(
        DimDate[Date],
        -1,
        MONTH
    )
)

Sales MoM % =
DIVIDE(
    [Total Sales] - [Sales Previous Month],
    [Sales Previous Month]
)

MoM analysis is commonly used to monitor short-term trends and seasonal changes.


Common Time Intelligence Mistakes

Many Time Intelligence issues are caused by problems with the Date table rather than the DAX itself.

Common mistakes include:

  • Using transaction dates without a dedicated Date table.
  • Forgetting to Mark as Date Table.
  • Missing dates in the calendar.
  • Using multiple unrelated Date tables.
  • Applying Time Intelligence functions to non-date columns.

A complete, continuous Date table is essential for reliable calculations.


Best Practices

When working with Time Intelligence:

  • Create a dedicated Date dimension.
  • Mark it as the official Date table.
  • Use one Date table across the entire model.
  • Build reusable base measures such as [Total Sales].
  • Base Time Intelligence measures on existing measures rather than repeating calculations.
  • Test calculations using slicers for Year, Quarter, and Month.

Following these practices makes Time Intelligence measures easier to maintain and reuse.


Summary

Time Intelligence allows Power BI to perform sophisticated date-based calculations with relatively simple DAX.

Common functions include:

  • TOTALYTD()
  • TOTALMTD()
  • TOTALQTD()
  • DATESYTD()
  • DATEADD()
  • SAMEPERIODLASTYEAR()

Combined with CALCULATE(), these functions make it possible to build running totals, period comparisons, growth metrics, and executive dashboards.

Mastering Time Intelligence is one of the final milestones toward becoming proficient in DAX.


Next Steps

Continue exploring advanced DAX concepts: