01.9The star schema

Your tables are separated and linked. Seen from above, they form a simple shape, the fact table in the center and the dimension tables around it. This shape has a name, and Microsoft recommends it.

01.9.1Facts in the center

Sales is in the center. Customers, Products and Calendar are linked to it, each through its own relationship. Seen from above, the model looks like a star. It is called the star schema.

Here is the same star in the Power BI Model view.

Click a relationship, in the diagram or in the list, to see the two columns it links.
Customers
City
Customer ID
Name
Type
Products
Brand
Category
Model
Product Code
Sales
Amount
Customer ID
Date
Price
Product Code
Qty
Sale ID
Calendar
Date
Manage relationships

This is a reproduction of the Power BI interface for teaching purposes. It differs from the real interface.

Each dimension touches only the fact table. The dimensions are not linked to each other.

Tips
  • The star is just one way to draw the model. What matters is the relationships, not where the tables sit on screen. In Model view, many people prefer to place the dimension tables at the top and the fact table below. The drawing then follows the filter, which flows down from the dimensions to the facts.

  • A model can have several fact tables, for example Sales and “Budgets,” which share the same dimensions. Each fact table stays at the center of its own star.

01.9.2Why a star

The star gives each filter a single path. A filter on the city goes from Customers to Sales, and nowhere else. The results are predictable.

It also makes the file lighter. The descriptions are written only once, in the dimensions, and the fact table keeps only codes and numbers.

Watch out!

Power BI lets a filter flow back up, by setting a relationship to “Both” directions. It is tempting when a figure doesn’t move. But it can create several possible paths, totals that are hard to explain and a slower report. In a star, keep the single direction, and handle the case in the measure.

01.9.3What Microsoft recommends

Microsoft publishes guidance for building a Power BI model. The main points match what this step shows.

  • A star schema, with the fact table in the center and the dimension tables around it.
  • Only the columns and rows you need. A column that no visual and no measure uses makes the file heavier for nothing.
  • The right type for each column. A number stored as text doesn’t add up and takes more space.
  • Whole-number keys to link the tables.
  • A date table, with the “Auto date/time” option turned off.
  • One-to-many relationships, in a single direction. Filtering in both directions remains an exception.
  • Columns prepared in Power Query, the data preparation tool of Power BI, rather than in DAX, when possible.

Each one makes the file lighter, the visuals faster or the results easier to predict. As for the date table, you added it at the beginning of this step.

Tip

In this course, keys are written C001 or A101 to stay readable. In a real model, a whole number takes less space.

Quiz

The questions often rely on the course tables. Keep them in view in their floating window, which you can move and enlarge.

Question 1

In a star schema, how is the Customers table linked to the Products table?

Question 2

A model has two fact tables, Sales and “Budgets,” both linked to the same Products table. A slicer on Products[Brand] keeps Velmo. What does it filter?

Question 3

In a visual by brand, a measure that counts the rows of Customers shows 7 on every row. What is the right way to handle it?

Key takeaways
  • In a star schema, the fact table is in the center, and each dimension is linked only to it.
  • The star gives each filter a single path, which makes the results predictable and the file light.
  • Setting a relationship to “Both” directions can create several paths. It is best avoided.
  • Microsoft recommends a star schema, only the columns you need, the right type for each column, whole-number keys and single-direction relationships.