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:
| Column | Purpose |
|---|---|
| Date | Calendar date |
| Year | Reporting year |
| Quarter | Calendar quarter |
| Month | Month name |
| Month Number | Sort order |
| Week | Week 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:
- Select the Date table.
- Open the Table Tools ribbon.
- Choose Mark as Date Table.
- 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
|
|
DimStoreThe 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:
| Month | Monthly Sales | Sales 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 YearThis 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
| Requirement | Function |
|---|---|
| Year-to-Date | TOTALYTD() |
| Month-to-Date | TOTALMTD() |
| Quarter-to-Date | TOTALQTD() |
| Previous Year | SAMEPERIODLASTYEAR() |
| Shift Dates | DATEADD() |
| Custom YTD Filters | DATESYTD() |
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:
| Month | Monthly Sales | Running 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:
| Year | Sales | YoY Growth |
|---|---|---|
| 2025 | $500,000 | — |
| 2026 | $575,000 | 15% |
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:
Iterator Functions (X Functions)
Learn how DAX iterator functions evaluate expressions row by row using functions such as SUMX, AVERAGEX, COUNTX, MINX, and MAXX.
ALL(), ALLEXCEPT(), ALLSELECTED() & REMOVEFILTERS()
Learn how DAX filter removal functions modify filter context for percentages, rankings, running totals, and advanced calculations.