Sub topic 8
How filters flow from dimensions to facts
This chapter assumes you can open Model view in Power BI Desktop, you know what primary and foreign keys are, and you have read basic DAX such as SUM. It also assumes you have already created one-to-many relationships between dimensions and a fact table.
The working model
A relationship in Power BI does more than link two tables. It also defines a path along which filters travel. In a star schema, the "one" side is a dimension and the "many" side is the fact table. By default, a filter moves from the one side to the many side, and only in that direction.
When a user picks "Bikes" in a slicer on DimProduct[Category], Power BI applies that filter to DimProduct. The filter then follows the relationship on ProductKey and keeps only the FactSales rows whose ProductKey belongs to a bike product. A measure such as SUM ( Sales[SalesAmount] ) then adds up only those rows.
A measure that relies on this flow
The measure itself has no filter logic. It does not mention products, dates, or categories.
Total Sales = SUM ( Sales[SalesAmount] )
Total Quantity = SUM ( Sales[Quantity] )The same measure gives different results in different places. In a matrix with Category on rows, each row's filter reaches Sales and the measure sums only that slice. In a card with no filters, it sums the whole table. The visual and the relationships supply the filter context. The measure only aggregates.
Why the direction is one-way
Filters do not travel from the fact table back to a dimension unless you change the relationship. This is usually what you want.
- A date slicer filters sales. A product slicer filters sales. Both can be active together, and the fact table receives the combined filter.
- Selecting a fact row does not narrow the product list, so dimensions stay stable and predictable.
- The model has one clear path for every filter, which keeps results easy to explain.
Power BI lets you set a relationship's cross-filter direction to "Both". This makes a filter on the many side also flow back to the one side. It can seem useful, for example to show only products that have sales. However, it creates extra filter paths, can produce ambiguous results when several dimensions are involved, and can slow queries. Keep relationships single-direction by default. Use a measure or a visual-level filter to solve "only show items with sales" instead.
Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| Slicer on a dimension changes nothing | No relationship, or the relationship is inactive | Check Model view. A dashed line means inactive. |
| Every category shows the same total | The visual uses a column from the fact table, or the relationship is missing | Use the dimension column in the visual. |
| A slicer on one dimension hides values in another | A bidirectional relationship is on | Set the direction back to single. |
| Blank row in a dimension visual | Fact rows have keys that do not exist in the dimension | Add the missing keys to the dimension or fix the source data. |
Place dimension fields, not fact-table fields, in slicers, rows, and columns. Fields from the dimension are the ones that filter through the relationship.
Exercise
A matrix shows DimProduct[Category] on rows and [Total Sales] as the value. Explain how the Bikes row gets its number, and say what would happen if the relationship between DimProduct and Sales were removed.
Show answer
The row for Bikes filters DimProduct to bike products. The filter follows the ProductKey relationship to Sales, which keeps only bike rows. SUM ( Sales[SalesAmount] ) then totals those rows. Without the relationship, the filter cannot reach Sales, so every row would show the same grand total.