Excel Course
Data Models in Power Pivot
A data model is more than a collection of tables. It is a structured set of relationships, rules, and context that determines how every calculation in your PivotTables and DAX formulas behaves. Understanding how filter context flows through relationships — and how to design a model that supports the questions you want to answer — is the foundation of everything in Power Pivot. This lesson covers multi-table model design, the Date Table, calculated columns, and how to use your model as the source for connected PivotTables.
Filter Context — How the Model Thinks
Filter context is the most important concept in Power Pivot. It is the set of filters currently active — from PivotTable row labels, column labels, slicers, and report filters — that determines which rows each calculation sees. When you drop "Region = North" into a PivotTable filter, the model applies that filter to every related table through the relationships. Sales rows are filtered. And because Sales is related to Products and Customers, those tables are filtered too — but only in the direction the relationship allows.
Region = North
→ 3 matching customers
CustomerID relationship
CustomerID filtered
→ 42 matching rows
ProductID relationship
ProductIDs sold to North
→ 8 products
those sold to North customers
The direction matters enormously. By default, filters flow from the one side (dimension) to the many side (fact) — from Products into Sales, from Customers into Sales. They do not automatically cross from one dimension to another through the fact table. If you need to filter Products based on a filter on Customers, that requires a special DAX function called CROSSFILTER or a bidirectional relationship — both covered in later lessons.
The Date Table — A Required Component
Any data model that involves time-based analysis — year-to-date totals, month-over-month comparisons, rolling 12-month averages — requires a dedicated Date Table. Power Pivot's time intelligence DAX functions only work correctly when a proper Date Table is present and marked as such. A Date Table is a dimension table with one row for every calendar date in your data range, and a set of attribute columns like Year, Month, Quarter, and Week Number.
| Date | Year | Quarter | Month Num | Month Name | Week Num | Day of Week |
|---|---|---|---|---|---|---|
| 01/01/2025 | 2025 | Q1 | 1 | January | 1 | Wednesday |
| 02/01/2025 | 2025 | Q1 | 1 | January | 1 | Thursday |
| 03/01/2025 | 2025 | Q1 | 1 | January | 1 | Friday |
| ... one row per day ... | ||||||
| 31/12/2025 | 2025 | Q4 | 12 | December | 52 | Wednesday |
Creating a Date Table — three options:
Option 1 — Power Query (recommended):
= List.Dates(#date(2025,1,1), 365, #duration(1,0,0,0))
Add columns for Year, Month, Quarter, Week Number using Date functions
Load to Data Model
Option 2 — DAX in Power Pivot:
DateTable = CALENDAR(DATE(2025,1,1), DATE(2025,12,31))
Then add calculated columns for Year, Month, etc.
Option 3 — Auto Date/Time (not recommended for production):
Power Pivot creates hidden date hierarchies automatically
Useful for quick exploration but lacks control and custom attributes
Marking the Date Table (required for time intelligence):
In Power Pivot → click the Date table tab
Design → Mark as Date Table → select the Date column
Power Pivot now knows this is the official date axis for time calculations
Marking the table as a Date Table is a non-obvious but critical step. Without it, DAX time intelligence functions like TOTALYTD, SAMEPERIODLASTYEAR, and DATESYTD will not work correctly — they require a marked Date Table to understand what "year-to-date" or "same period last year" means. It takes two clicks and saves a lot of debugging pain later.
Calculated Columns vs Measures
Power Pivot lets you add two kinds of DAX calculations to your model: calculated columns and measures. They look similar but work completely differently. Understanding the distinction is one of the most important things to learn before writing any DAX.
| Calculated Column | Measure | |
|---|---|---|
| Calculated when | At data load / refresh — stored row by row | At query time — recalculated for each cell in the PivotTable |
| Row context | Has row context — can reference other columns in the same row | No row context by default — works on a filtered set of rows |
| Appears in | The table as a new column — visible in field list under its table | The Values area of PivotTable — visible in field list with a calculator icon |
| Memory use | Stored — uses memory proportional to table size | Not stored — calculated on demand, more memory-efficient |
| Use for | Row-level attributes: profit per row, full name, category flags | Aggregations: total sales, % of total, YTD, averages, ratios |
The practical rule: use a calculated column when you need a value attached to each row — something that is a property of the row itself, like Profit = Revenue - Cost for each individual transaction. Use a measure when you need an aggregation that responds to the PivotTable's current filter context — like Total Sales, which should change depending on which region, product, or time period is selected. Measures are the more powerful of the two and the majority of DAX work involves measures.
Adding a Calculated Column
Calculated columns are added directly in the Power Pivot table view. Click into the first empty column to the right of the existing columns, type a name in the header, and enter a DAX formula in the formula bar. The formula is evaluated for every row in the table using row context — you reference column names in square brackets, and DAX automatically applies the formula row by row.
In the Power Pivot window — Sales table — click the Add Column header
Profit per transaction:
= [Revenue] - [Cost]
Revenue multiplied by a related column from Products:
= [Quantity] * RELATED(Products[UnitPrice])
Full date label for display:
= FORMAT([OrderDate], "MMM YYYY")
Boolean flag — large order:
= IF([Revenue] > 10000, TRUE, FALSE)
Note: RELATED() lets a calculated column in the fact table
reach into a related dimension table to pull a value for each row.
This is the calculated column equivalent of VLOOKUP.
| OrderID | Quantity | Revenue | Cost | Profit ✦ | Month ✦ | Large? ✦ |
|---|---|---|---|---|---|---|
| 1001 | 5 | £12,500 | £8,200 | £4,300 | Jan 2025 | TRUE |
| 1002 | 2 | £4,800 | £3,100 | £1,700 | Feb 2025 | FALSE |
| 1003 | 8 | £19,200 | £11,400 | £7,800 | Feb 2025 | TRUE |
Adding a Simple Measure
Measures are defined in the Calculation Area — the grey space below the rows in the Power Pivot table view. Click any cell in the calculation area, type the measure name followed by a colon and equals sign, and enter the DAX formula. Measures are then available in the PivotTable field list under their home table, marked with a small calculator icon.
In Power Pivot → Calculation Area (grey space below the table rows)
Click a cell → type the measure name := formula
Basic aggregation measures:
Total Revenue := SUM(Sales[Revenue])
Total Cost := SUM(Sales[Cost])
Total Profit := SUM(Sales[Profit])
Order Count := COUNTROWS(Sales)
Avg Order := AVERAGE(Sales[Revenue])
Measures that reference other measures:
Profit Margin % := DIVIDE([Total Profit], [Total Revenue], 0)
(DIVIDE is safer than [Total Profit] / [Total Revenue] because
it handles division by zero gracefully — returns 0 instead of error)
These measures respond to every filter on the PivotTable:
- Drop Region on rows → each region shows its own Total Revenue
- Add a Year slicer → all measures update to show only that year
- No formula changes needed — the filter context does all the work
| Region from Customers |
Category from Products |
Total Revenue measure |
Profit Margin % measure |
|---|---|---|---|
| North | Electronics | £312,000 | 34.2% |
| Furniture | £307,000 | 28.8% | |
| East | Electronics | £289,000 | 31.7% |
| Furniture | £271,000 | 26.4% |
Using the Data Model as a PivotTable Source
Once your data model is built, you create PivotTables from it rather than from a single worksheet range. The PivotTable field list shows all tables in the model with all their columns and measures available. You can drag from any table into rows, columns, filters, and values — and the model's relationships ensure the numbers are always correct.
Creating a PivotTable from the Data Model:
Insert → PivotTable → tick "Use this workbook's Data Model" → OK
Or from the Power Pivot window:
Home → PivotTable → Single PivotTable
The field list shows all model tables.
Expand any table to see its columns and measures.
Measures appear with a calculator icon (Σ).
Best practices for model-based PivotTables:
- Always use measures in the Values area — avoid raw column aggregations
- Measures respect filter context; raw column sums may not behave as expected
- Use slicers connected to dimension table columns (Region, Category, Year)
for clean filtering that propagates through the entire model
One practical tip: when you have multiple PivotTables on a dashboard all sourced from the same data model, slicers can be connected to all of them at once. Right-click a slicer → Report Connections → tick every PivotTable that should respond to it. This creates a fully connected dashboard where one click on a slicer updates every table and chart on the page simultaneously — driven by the model's relationships, not by complex formulas.
🟠 Practice
Q1. You want to create a measure that calculates total profit divided by total revenue, and you want it to return 0 if revenue is zero rather than a divide-by-zero error. Write the DAX measure.
Q2. You need to add a Profit column to the Sales table in Power Pivot that calculates Revenue minus Cost for every row. Is this a calculated column or a measure, and where do you create it?
Q3. Why does a proper Date Table need to be marked as a Date Table in Power Pivot, and what feature requires it?
🟣 Quiz
Q1. A measure called Total Revenue returns £2.4M when no filters are applied. When you add Region = "North" to the PivotTable rows, it returns £619K for North. What caused the value to change?
Q2. What does the RELATED() function do in a Power Pivot calculated column?
Q3. You have multiple PivotTables on a dashboard, all sourced from the same data model. You add a Region slicer. By default, does it filter all PivotTables or just the one it was created on?
Next up — DAX Basics, where we go deeper into the DAX formula language — learning CALCULATE, the most important function in Power Pivot, along with FILTER, ALL, and the core patterns that make measures powerful and flexible.