Sub topic 1
Why time intelligence needs a date table
Time intelligence is the group of DAX calculations that compare periods: year-to-date, same period last year, month-over-month growth, rolling 12 months. These calculations look simple, but they depend on the model having a particular kind of table. This chapter explains what that table is for and what goes wrong without it. Later chapters build one step by step.
Prerequisites
This chapter assumes you already have the following:
- Basic Power BI Desktop navigation: you can switch between Report, Table, and Model views.
- Familiarity with tables, columns, and relationships in a data model.
- Basic DAX syntax for calculated columns and measures.
- Awareness of the difference between fact tables (events such as sales rows) and dimension tables (descriptive lists such as products or dates).
You don't need to have built a date table before.
What time intelligence functions actually do
A function such as SAMEPERIODLASTYEAR doesn't look up last year's number. It changes the filter on the date column and then lets the rest of the measure evaluate under that new filter.
Suppose a report cell shows March 2026. The filter context holds the dates 1 March through 31 March 2026. SAMEPERIODLASTYEAR shifts that set back one year, so it holds 1 March through 31 March 2025. CALCULATE then evaluates [Total Sales] under the shifted filter.
Total Sales = SUM ( Sales[Amount] )
Sales PY =
CALCULATE ( [Total Sales], SAMEPERIODLASTYEAR ( 'Date'[Date] ) )For the shift to be correct, the column it operates on has to behave like a calendar. Every day must exist exactly once, and the days must be consecutive. A column in a fact table doesn't behave that way.
Why a fact table's date column is not enough
A date column in a fact table, such as Sales[OrderDate], has three properties that break period logic.
- Gaps. If the business closed on a holiday or recorded no orders on a Sunday, those dates don't appear in the column. A function that shifts or walks through dates can't find them.
- Duplicates. Hundreds of rows can share one date. A calendar needs one row per day.
- Partial range. The column covers only the days with data. If the last order was on 12 November, a year-to-date calculation has no 13 to 30 November to work with, and a "full year" comparison can't be built for the missing days.
The functions that move between periods, such as DATEADD, SAMEPERIODLASTYEAR, and PARALLELPERIOD, expect a column of unique, consecutive dates. When they receive a gappy column, they can return an error or a number built from an incomplete set of days. The second case is worse, because the report still displays a value and nothing warns you that it is wrong.
You can check how gappy your own fact column is with a DAX query. Run it in DAX query view, or in any tool that can run DAX queries against the model.
EVALUATE
ROW (
"First date", MIN ( Sales[OrderDate] ),
"Last date", MAX ( Sales[OrderDate] ),
"Days in range",
DATEDIFF ( MIN ( Sales[OrderDate] ), MAX ( Sales[OrderDate] ), DAY ) + 1,
"Distinct order dates", DISTINCTCOUNT ( Sales[OrderDate] )
)If "Distinct order dates" is smaller than "Days in range", the fact column has gaps. For most business data it is smaller.
What a date table provides
A date table is a dimension table with one row per calendar day. It solves the problems above and adds more.
| Need | What the date table provides |
|---|---|
| Consecutive days | One row for every day in the range, including days with no transactions |
| Unique days | Each date appears once, so it can be the "one" side of a relationship |
| Full years | The range starts on 1 January and ends on 31 December, so period functions see whole years |
| Grouping | Columns for year, quarter, month, and week that visuals can use as axes and slicers |
| One shared calendar | Several fact tables (sales, budget, inventory) can filter by the same dates |
The last row matters in larger models. If sales and budget each used their own date column, one date slicer couldn't filter both. With a date table, both fact tables relate to it, and one slicer controls every visual.
How the pieces fit together
The date table sits on the "one" side of a relationship. The fact table sits on the "many" side. A slicer on the date table filters the fact table, and time intelligence functions rewrite that same filter.
The measure never touches the fact table's dates directly. It changes the filter on the date table, and the relationship carries that change to the fact table. That is why the date table must be a proper calendar. The shifted filter has to land on real, consecutive dates.
A worked comparison
Consider a small shop that sells on weekdays only. Its Sales table holds these order dates in one week:
- Monday 2 March
- Tuesday 3 March
- Wednesday 4 March
- Thursday 5 March
- Friday 6 March
A fact-only "date list" contains five dates for that week. Saturday 7 March and Sunday 8 March are absent. Now take a measure that looks at a rolling window of 7 days. Over the fact column, "7 days back from 6 March" can't be found as a window of 7 consecutive dates, because two of those dates don't exist in the column. A date table has all seven days, so the window is well defined, and the weekend days simply contribute zero sales.
The same applies across years. If the shop opened on 15 June 2025, a fact-only column starts on 15 June. "Same period last year" for June 2026 then looks at a 2025 month that starts partway through. A date table spanning whole calendar years makes that comparison start on 1 June, and the days before opening show blanks.
Where this sits among your options
Power BI has a built-in shortcut, automatic date/time, which creates hidden date tables for you. It is convenient for a quick report, but it has limits that a dedicated table avoids. The next chapter covers it in detail. In summary, a table you build yourself gives you control over four things:
- The date range and the fiscal calendar.
- The columns available for grouping and sorting.
- A single calendar shared by every fact table.
- Behavior you can inspect, test, and reuse across reports.
What goes wrong without one
These are the symptoms you are likely to see when a model relies on a fact date column. Knowing them helps you recognize the cause later.
- Wrong numbers with no error. A year-to-date or prior-year figure is lower than it should be because some days are missing from the shifted filter.
- Errors about dates. A measure fails with a message that the dates must be contiguous or that a date column cannot be used.
- Blank prior-period values. A comparison returns blank for early months because the shifted range falls outside the dates present in the column.
- Slicers that don't line up. Two fact tables each have their own dates, so a single slicer filters only one of them.
- Axes in the wrong order. Month names sort alphabetically (April, August, December) instead of by calendar order. Chapter 7 explains the fix.
What you will build next
The rest of the tutorial follows a fixed path. You will see what automatic date/time does and where it falls short. You will learn what makes a date table valid. Then you will build the table with DAX and with Power Query, add calendar columns, set sort-by-column, relate it to the fact table, and mark it as the date table. After that you will write measures against it and adapt it for fiscal years and for facts with several date columns. The tutorial ends with validation steps.
Before moving on, keep one rule in mind. A fact table records what happened, and a date table records the calendar. Time intelligence needs the calendar.
Exercise
A Sales table has an OrderDate column covering 1 March 2025 to 12 November 2026. The business takes no orders on Sundays. Give two reasons why OrderDate alone is a poor basis for a "same period last year" measure, and name one property a dedicated date table adds that fixes each reason.
Show answer
First, OrderDate has gaps, because Sundays and any other no-order days are missing. A date table has one row for every day, so the shifted filter always lands on real dates. Second, the range is partial. It starts on 1 March 2025 and ends on 12 November 2026, so a year-to-date or prior-year comparison for 2025 and 2026 lacks the days before 1 March and after 12 November. A date table that runs from 1 January to 31 December of each year covers whole years. A third valid reason is duplicates: many rows share one date, so the column can't be the "one" side of a relationship, while a date table has each date exactly once.
Exercise
You run the diagnostic DAX query from this chapter. It returns "Days in range" of 600 and "Distinct order dates" of 512. What does this tell you, and does it prove your time intelligence measures are wrong?
Show answer
It tells you the fact column is missing 88 days, so it has gaps. It does not prove the measures are wrong, because the measures might already use a proper date table. It does mean that any time intelligence measure pointed at Sales[OrderDate] is unreliable. Those measures should use the date column of a dedicated date table instead.