Power BI Star Schema Design
A star schema is the layout that Microsoft recommends for Power BI models. One large table sits in the center, and smaller tables surround it like points of a star. Models built this way run faster, stay easier to read, and produce fewer calculation errors.
Fact Tables and Dimension Tables
A fact table records events. Each row represents one sale, one click, one delivery, or one payment. Fact tables grow tall, and they hold numbers such as quantity and revenue along with key columns that point to other tables.
A dimension table describes the who, what, where, and when of those events. A Products table, a Customers table, a Stores table, and a Date table are dimensions. Each dimension holds one row per item and many descriptive columns.
The Receipt and Catalog Analogy
Imagine a pile of shop receipts and a set of catalogs. Receipts say which item sold, who bought it, and the amount. Catalogs describe each item, each customer, and each store in detail. Receipts stay short and repeat constantly. Catalogs hold the long descriptions once.
+-----------+
| Product |
| (catalog) |
+-----+-----+
|
+-----------+ +-----+-----+ +-----------+
| Customer |----| SALES |----| Store |
| (catalog) | | (fact) | | (catalog) |
+-----------+ +-----+-----+ +-----------+
|
+-----+-----+
| Date |
| (catalog) |
+-----------+
Why Star Schema Works Well
Speed
Power BI compresses narrow tables with repeated values very well. Dimension columns stay out of the huge fact table, so memory use drops and visuals respond quickly.
Clarity
Report authors find fields easily. Product details live in Products, and customer details live in Customers. Nobody hunts through one giant sheet with eighty columns.
Accuracy
One-to-many relationships flow from each dimension into the fact table. Filters travel in a predictable direction, and totals behave as expected.
Flat Table Versus Star Schema
| Feature | Single Flat Table | Star Schema |
|---|---|---|
| Repeated text | Product name repeats on every row | Product name stored once |
| File size | Large | Smaller |
| Updating a name | Edit thousands of rows | Edit one row |
| Reuse of dimensions | Not possible | Shared by many fact tables |
Building a Star Schema Step by Step
- List the business events you want to measure, such as orders.
- Place those events in one fact table with numeric columns and key columns.
- Split descriptive columns into separate dimension tables.
- Give each dimension a unique key column.
- Create one-to-many relationships from each dimension key to the matching fact column.
- Hide key columns in the fact table so report authors see only useful fields.
Power Query helps with the split. Duplicate the flat query, keep only the product columns, and remove duplicate rows. The result becomes a clean Products dimension.
Worked Example: A Coffee Chain
A coffee chain exports one sheet with Date, Store, Drink, Customer, Quantity, and Price. The analyst creates a Sales fact table with the keys and numbers. A Drinks dimension lists each drink with its size and category. A Stores dimension lists each store with city and manager. A Date dimension provides year, month, and weekday. A slicer on Store City now filters sales instantly, and a chart by Drink Category loads without delay.
Snowflake Schema Note
A snowflake schema splits dimensions into further sub-tables, such as Product linked to Category. Snowflakes work, yet they add relationship hops. Flatten dimensions into single tables whenever possible.
Key Points
- Fact tables hold events and numbers, and dimension tables hold descriptions.
- One-to-many relationships connect each dimension to the fact table.
- Star schemas reduce file size and speed up visuals.
- Power Query splits flat sheets into clean dimensions.
- Keep dimensions flat instead of building snowflakes.
