Sub topic 1
Fact and dimension tables: the shape relationships serve
Prerequisites
This chapter assumes you can do the following:
- Open Power BI Desktop and load data from a file or database into tables.
- Read a table as rows and columns.
- Build a simple visual and add a slicer.
- Write or recognize a basic measure, such as a sum of one column.
You do not need to know how relationships work yet. This chapter explains the table shapes that relationships are designed to connect.
Why table shape comes before relationships
A relationship tells Power BI how a filter on one table should reach another table. If the tables are shaped badly, the relationships needed to connect them become awkward, slow, or ambiguous. Most wrong totals in a report come from a model whose tables do not follow a clear pattern.
The pattern that Power BI is built for is the star schema. It splits data into two kinds of tables:
- Fact tables record events or measurements.
- Dimension tables describe the things those events involve.
Fact tables
A fact table is a table where each row records one event, such as a sale, a shipment, a click, or a payment. It has two kinds of columns:
- Numeric columns you aggregate, such as
SalesAmountorQuantity. These are often called measures' source columns. - Key columns that identify which customer, product, or date the event belongs to, such as
CustomerKeyorProductKey.
Fact tables are usually long and narrow. They can hold millions of rows but only a handful of columns.
Here is a small Sales fact table:
| SalesKey | OrderDate | ShipDate | CustomerKey | ProductKey | SalesAmount |
|---|---|---|---|---|---|
| 1 | 2026-01-05 | 2026-01-07 | 101 | 11 | 250 |
| 2 | 2026-01-05 | 2026-01-09 | 102 | 12 | 80 |
| 3 | 2026-01-06 | 2026-01-08 | 101 | 12 | 80 |
Notice what the table does not contain. It has no customer names, no product categories, and no month names. It holds only keys that point to that information elsewhere.
Dimension tables
A dimension table is a table where each row describes one thing, such as one customer, one product, or one calendar date. It has one key column whose values are unique, plus descriptive columns you use to group and filter.
Here is a small Product dimension table:
| ProductKey | ProductName | Category | Color |
|---|---|---|---|
| 11 | Trail Bike | Bikes | Red |
| 12 | Helmet | Accessories | Black |
| 13 | Water Bottle | Accessories | Clear |
Dimension tables are usually short and wide. They have fewer rows than the fact table but many descriptive columns. Those columns are what you drag onto an axis, into a legend, or into a slicer.
Product 13 has no sales yet. That is normal. A dimension can contain rows that no fact row uses.
How the star shape forms
When you place the fact table in the middle and connect each dimension to it, the diagram looks like a star. The fact table is the center and the dimensions are the points.
The arrows show the direction a filter normally travels. When a user picks "Accessories" in a slicer built on Product[Category], the filter moves from Product into Sales. Only the sales rows for accessory products remain, and a measure such as SUM ( Sales[SalesAmount] ) adds up just those rows.
This is the core idea of the whole tutorial. Dimensions filter facts. Relationships are the paths that carry that filter, and the later chapters on cardinality and filter direction describe how those paths behave.
Why this shape works well
The star schema is not just tidy. It gives practical benefits:
- Each fact is stored once. A product's category is stored in one row of
Product, not repeated on millions of sales rows. Changing a category means editing one row. - Filters have one clear path. Every dimension reaches the fact table by exactly one route, which avoids the ambiguous paths covered later.
- Slicers behave predictably. A slicer on a dimension column shows each value once, because dimension keys are unique.
- The engine compresses well. Power BI stores columns separately and compresses repeated values. Narrow fact tables with numeric keys compress better than wide tables full of text.
A flat table versus a star
Many first models start as one wide table, often produced by a database export or a spreadsheet. Every row repeats the customer name, product name, category, and date parts next to the amount.
A flat table works for small reports. It starts to cause trouble when:
- You need two different date meanings, such as order date and ship date, and one date column cannot serve both.
- A customer or product appears in the data but has no sales, so there is no row to show it.
- Descriptive values are spelled slightly differently across rows, so a slicer lists "Bikes" and "bikes" separately.
- The file grows large because the same text repeats on every row.
Splitting the flat table into one fact table and several dimensions fixes these problems. Power Query is the usual place to do the split, by referencing the source query, keeping only the needed columns, and removing duplicates to create each dimension.
Spotting fact and dimension tables in your own data
When you are unsure which kind a table is, ask these questions:
- Does a row record something that happened, at a point in time? If yes, it is probably a fact.
- Do you sum, average, or count the table's numeric columns? If yes, it is probably a fact.
- Does a row describe something that exists, such as a person, product, or place? If yes, it is probably a dimension.
- Is the key column unique, with one row per key? If yes, it is a dimension candidate.
Some tables are less clear. A Budget table that holds one amount per category per month is a fact table, even though it is small. A Customer table with a CreditLimit column is still a dimension, because you would group by customer rather than add up the limits.
Common mistakes
- Treating a lookup list as a fact table. A table of order statuses that you only use for slicing is a dimension.
- Joining two fact tables directly. Two fact tables, such as
SalesandReturns, should each connect to shared dimensions rather than to each other. The shared dimensions let one slicer filter both. - Putting descriptive text in the fact table. If
SalescarriesProductName, you have two places that can disagree. - Using a date column from the fact table for grouping by month. A separate
Datedimension lets every fact table share one calendar.
A shared dimension that filters several fact tables is sometimes called a conformed dimension. It is what lets a single Date table slice both sales and returns.
What comes next
The next chapters move into the Model view, where you see these tables as boxes and draw the relationships between them. Keep the picture of the star in mind. Each line you draw connects a unique key on a dimension to a repeating key on the fact table.
Exercise
A table has one row per product, with columns ProductKey, ProductName, Category, and ListPrice. Another table has one row per order line, with columns OrderLineKey, ProductKey, OrderDate, and Quantity. Which is the fact table, which is the dimension, and which direction does a filter from a Category slicer normally travel?
Show answer
The order line table is the fact table, because each row records an event and it has a numeric column (Quantity) that you aggregate. The product table is the dimension, because each row describes one product and ProductKey is unique. A Category slicer filters the Product dimension first, and that filter travels from Product to the order line table through the ProductKey relationship, leaving only the order lines for the selected category.
Exercise
Your model has a single wide Sales table that repeats CustomerName and Region on every row. Give two problems this can cause, and describe how a star schema fixes them.
Show answer
First, a customer who has not bought anything has no row, so they cannot appear in a visual or slicer. Second, a name spelled two ways across rows shows up as two separate values in a slicer. The star schema moves customer details into a Customer dimension with one row per customer. Customers without sales still have a row, and each name is stored once, so the slicer lists it once. The Sales fact table keeps only CustomerKey.