Sub topic 8
Relating the date table to your fact table
This chapter assumes you can navigate Model view, know the difference between fact and dimension tables, and can read basic DAX. You already have a date table with one row per day. Now you connect it to the fact table so that filters on dates reach your sales rows.
The relationship you want
A date table is a dimension. The fact table (here, Sales) holds one row per order. The correct relationship is:
- From
'Date'[Date](the "one" side) toSales[OrderDate](the "many" side). - Cardinality: one-to-many.
- Cross-filter direction: single, from
DatetoSales.
With this setup, a slicer on 'Date'[Year] filters Date, and the filter flows down to Sales. Measures such as SUM ( Sales[Amount] ) then respond to the slicer.
Creating the relationship
- Open Model view.
- Drag
Date[Date]ontoSales[OrderDate]. Power BI creates the relationship and usually detects one-to-many. - Double-click the relationship line to open Edit relationship.
- Confirm the cardinality is One to many (1:*), the cross-filter direction is Single, and Make this relationship active is checked.
If Power BI created a relationship automatically, check it anyway. Auto-detection can pick the wrong columns or direction.
Match the data types
Both columns must have the same type. A common trap is that OrderDate is a Date/Time column while 'Date'[Date] is a Date column. If the order column includes a time of day, such as 2026-03-14 15:42, it will not match the midnight value 2026-03-14 in the date table. Those rows then fall outside every date.
Fix this in Power Query by changing the type of OrderDate to Date, which drops the time portion. Do not create a calculated column in Sales if you can avoid it, because the change belongs upstream, where the data is loaded.
let
Source = Sales,
DateOnly = Table.TransformColumnTypes(Source, {{"OrderDate", type date}})
in
DateOnlyCommon errors
| Symptom | Likely cause | Fix |
|---|---|---|
| Many-to-many cardinality is offered | `Date[Date]` has duplicate values | Remove duplicates so each date appears once |
| Relationship line is dotted | The relationship is inactive | Make it active, or keep it inactive and use `USERELATIONSHIP` |
| Totals ignore the year slicer | No relationship, or the wrong direction | Relate `Date` to `Sales` with a single direction from `Date` |
| A "(Blank)" row appears in visuals | Fact dates are missing from the date table | Extend the date table range to cover all fact dates |
| Relationship cannot be created | The column types differ | Convert both columns to Date |
The blank row deserves attention. When a fact row has a date that is absent from the date table, Power BI groups it under a blank member. Building the date range from MIN and MAX of the fact column, as shown earlier with CALENDAR, prevents this.
Why single direction
Avoid setting the cross-filter direction to Both on this relationship. Bidirectional filtering lets fact table filters flow back into the date table. That can produce ambiguous filter paths when other dimensions are involved, and it slows queries. The date table should only filter facts, not the reverse.
Only one active relationship
Power BI allows only one active relationship between two tables. If Sales has OrderDate, ShipDate, and DueDate, you can create three relationships to Date, but only one is active. Make OrderDate the active one, since it is the date most reports use. The others stay inactive until a measure activates them. A later chapter covers this.
Test the relationship
Build a table visual with 'Date'[Year] and a measure:
Total Sales = SUM ( Sales[Amount] )Check that the yearly totals add up to the grand total of Sales[Amount]. If a year's total is blank or the grand total is higher than the sum of the rows, some fact dates are not matching.
Exercise
Your Sales[OrderDate] column is Date/Time and contains values like 2026-03-14 15:42. The date table relationship is active and one-to-many, but a card showing total sales for 14 March 2026 returns blank. What is the cause, and how do you fix it?
Show answer
The date table holds midnight values, so a timestamp with a time of day does not match any row in Date. Change OrderDate to the Date type in Power Query so the time portion is removed, then refresh.