Data Modeling in Power BI
Relationships decide which numbers your measures can see
A Power BI model says how tables join and how filters flow. Star schemas, single active relationships and correct cardinality keep models fast and totals correct.
What you will learn
- Explain the star schema: one fact, several dimensions
- Construct one-to-many relationships with correct filter direction
- Recognize why an extra active relationship breaks measures
What is this?
Data modeling is choosing tables, relationships and column roles so DAX can compute reliably. The recommended shape is a star: a central fact table holding transactions or events, and small dimension tables (date, customer, product, region) that describe and filter the facts. Relationships define how filters travel from a dimension to the fact, and cardinality defines how many rows match.
Why do you need it?
- A flat mega-table fights you: totals duplicate and every new measure needs hard-wired filters.
- A star keeps the model narrow, compressed and fast in the in-memory engine.
- A clean model needs fewer measures because DAX reuses the relationship instead of repeating joins in every formula.
- Bad relationships are the #1 cause of wrong subtotals and blank measures.
Mental model
A library catalogue
A dimensional model
The catalogue lists every book once in a dimensions table keyed by ISBN, while the lending-facts table references ISBNs. To know how many times each author was borrowed you join the loan facts to the author dimension — not store author names in every loan row.
How it works
- A fact table stores measures (amount, quantity, profit) and foreign keys to dimensions.
- A dimension table stores attributes at one grain — one row per customer, product, date.
- A one-to-many relationship filters from the dimension side to the fact side by default.
- The model engine compresses each column; narrow, high-cardinality columns stay cheap.
- Cross-filter direction defaults to single, which prevents unwanted fan-out between dimensions.
A star schema: facts in the middle, dimensions around it.
In production
- A retail model keeps one Sales fact and Date, Product, Store dimensions; every report slices by store without re-joining.
- A payments team marks one active relationship to the latest merchant table and 20 hidden ones for audit history.
- A marketing team models a 'first touch' dimension so DAX can define attribution once instead of per report.
Best practices
- Name keys consistently (customer_id etc.) and mark them as keys in Power Query.
- Keep one active relationship per pair of tables; hide alternatives.
- Set column data types and date keys as whole-number YYYYMMDD for fast filters.
- Add a hidden 'All' measure note: never block filter propagation with blank calendars.
Common mistakes
- Building many-to-many joins because you skipped modeling; they force ambiguous total logic.
- Letting relationships point from the fact to multiple dimensions with both directions cross-filtered.
- Leaving dates as text columns so date-intelligence DAX cannot run.
- Importing entire tables unmodeled (hours, minutes, seconds) into every model.
Common issues
A dimension disappears from filters after a refreshThe key column lost its type or new rows have trailing spaces
Trim and set types in Power Query before import; then re-create the relationship.
A measure returns nothing when sliced by one dimensionThe relationship points the wrong way or is inactive
Verify the line arrows point from dimension to fact and activate the intended join.
Dollar totals double when a second dimension is addedTwo active paths from a dimension cause fan-out through a many-to-many
Reduce to a single fact-key path and mark extra relationships inactive.
Debugging tips
- Visualize the relationship diagram: every line should cross from dimension to fact.
- Check cardinality by counting distinct keys in each table before joining.
- Turn on 'Cross filter direction: Both' only when a specific measure needs it, and re-test it.
- Use the Model view's line list to find inactive relationships quickly.
Interview checkpoint
Hands-on lab
- Load a fact and three dimensions
- Wire relationships on clean keys
- Verify filter flow across dimensions with one measure
- Repair a broken ambiguous relationship
Model a Sales Star
30 min · intermediate
Quick quiz
Which schema shape is recommended for a Power BI model?
Every pair of tables may have many active relationships at once.