Now that we can build a report, we look at what sits underneath it. On a model with millions of orders, the most common wrong number in Power BI does not come from a formula. It comes from the way the tables are linked. The formula is correct, the visual is correct, and the total is still wrong, so nobody looks at the model. To avoid that, we start with the shape that works best, which is the star schema.
The star schema in one picture
| Table | Role | Rows | Example columns |
|---|---|---|---|
| Orders | Fact: one row per event | Many | order_id, customer_id, order_date, total_amount |
| Customers | Dimension: one row per customer | One per customer | customer_id, name, city |
| Dates | Dimension: one row per day | One per day | date, month, year |
The fact table records what happened. The dimension tables describe who, when and where. Every relationship goes from the one side, the dimension, to the many side, the fact. A filter on a customer name then flows down to the orders of that customer, and a measure on Orders adds them up.
Trap 1: a dimension with duplicate keys
Marketing sends a segment list. Ruby Hoang appears twice, once as VIP and once as Active, because she qualifies for both. We load the list as a Segments table and link customer_id to Orders. Both columns now hold repeated values, so Power BI can only create a many-to-many relationship.
| customer_id | customer | segment |
|---|---|---|
| C1 | Ruby Hoang | VIP |
| C1 | Ruby Hoang | Active |
| C2 | Ethan Vu | Active |
| C3 | Kevin Do | VIP |
| C4 | Sophie Ly | Active |
Each segment is now correct on its own. VIP holds Ruby Hoang and Kevin Do, so Total Sales is 27 + 20 = 47 million. Active holds Ruby Hoang, Ethan Vu and Sophie Ly, so it is 27 + 13 + 18 = 58 million. The grand total, with no segment filter, is still 78 million. The two segments add up to 105 million, which is 27 million more than the company sold.
| Segment | Total Sales |
|---|---|
| VIP | 47,000,000 |
| Active | 58,000,000 |
| Sum of the two rows | 105,000,000 |
| Grand total | 78,000,000 |
The fix is to give every customer exactly one segment in the Customers dimension. If Ruby Hoang counts as VIP only, VIP is 47 million and Active is 13 + 18 = 31 million, and the two add up to 78 million. When a customer really belongs to several groups, that is a business question to settle first. A many-to-many relationship should only be used if we accept that the rows overlap.
Check for duplicate keys before you link
Before we link a dimension, we count whether its key is unique. The measure below returns 0 when every key appears once.
Duplicate Keys = COUNTROWS(Segments) - DISTINCTCOUNT(Segments[customer_id])For the table above, there are 5 rows and 4 different customers, so the result is 1. That one extra row is Ruby Hoang's second segment.
Trap 2: bidirectional filters
By default, a filter flows in one direction, from the dimension to the fact. Setting the cross-filter direction to Both lets filters also flow from the fact back to the dimension. It can look like a shortcut, for example to make a slicer list shrink to match another selection. It also has a cost. Filters can now reach a table through more than one path. The result may then depend on which fields are in the visual, and the model can become hard to predict.
- Keep the filter direction single, from the dimension to the fact, as the default.
- Use Both only when you can say which question needs it, and test the totals afterwards.
- If a result changes when you add an unrelated field to a visual, look for a second path between the tables.
A checklist for every model
- Each dimension has one row per key. Check it with
Duplicate Keys. - Each relationship is one-to-many, from the dimension to the fact.
- The rows of any breakdown add up to the grand total, unless the groups are meant to overlap.
- No relationship uses the filter direction Both without a written reason.


