Sub topic 1
Why Time Intelligence Needs a Date Table
Prerequisites
Assume you can navigate Power BI Desktop and understand tables, columns, relationships, fact tables, and basic DAX measures.
Why time intelligence needs a date table
Time intelligence means calculating values across time, such as year-to-date sales or sales for the same period last year. These calculations need a reliable sequence of dates.
A fact table often has dates, but it may contain only dates when transactions occurred. Missing dates can break comparisons and filtering. A dedicated date table contains one row for every day, including days with no activity. It provides shared calendar fields such as year, quarter, and month for reports.
Automatic date/time: what it does and where it falls short
Power BI can create hidden date tables automatically when the automatic date/time option is enabled. This is convenient for a quick report, but each date column can receive its own hidden hierarchy. That can increase model size and make calendar logic inconsistent.
Automatic tables also give you less control over fiscal calendars, custom week definitions, shared filtering, and multiple date roles. A visible, dedicated date table makes the model easier to inspect and maintain.
What a valid date table must contain
A date table should have:
- One row for every date in the required range.
- A date column with the Date data type.
- Unique, nonblank dates.
- No gaps in the sequence.
- Enough dates to cover the fact table and the reporting period.
After creating relationships, mark the table as a date table in Power BI and select its date column. This tells Power BI which column defines the calendar.
Creating the table with DAX
Create a calculated table with CALENDAR. This example covers complete calendar years around the data:
Date =
CALENDAR (
DATE ( YEAR ( MIN ( Sales[OrderDate] ) ), 1, 1 ),
DATE ( YEAR ( MAX ( Sales[OrderDate] ) ), 12, 31 )
)CALENDARAUTO() is another option. It derives the range from date values in the model, but explicit CALENDAR boundaries give you clearer control. Add columns such as Year, Quarter, and Month later, then relate Date[Date] to the fact table's order-date column.
Exercise
Why can a fact table's transaction dates be insufficient for time intelligence?
Show answer
It may omit dates with no transactions, so a dedicated table provides a complete, continuous calendar for filtering and comparison.