How does changing the relationship direction and cross-filtering between Sales and Products tables affect the total sales and product details shown in the dashboard?
Relationship direction and cross-filtering in Power BI - Dashboard Guide
| SalesID | ProductID | Quantity | SalesAmount |
|---|---|---|---|
| 1 | 101 | 2 | 200 |
| 2 | 102 | 1 | 150 |
| 3 | 103 | 3 | 450 |
| 4 | 101 | 1 | 100 |
| 5 | 104 | 5 | 500 |
| ProductID | ProductName | Category |
|---|---|---|
| 101 | Notebook | Stationery |
| 102 | Pen | Stationery |
| 103 | Chair | Furniture |
| 104 | Desk | Furniture |
| 105 | Lamp | Furniture |
- KPI Card: Total Sales Amount
Formula:Total Sales = SUM(Sales[SalesAmount])
Result: 1400 - Table Visual: Product Sales Details
Columns: ProductName, Category, Total Quantity Sold, Total Sales Amount
Measures:Total Quantity Sold = CALCULATE(SUM(Sales[Quantity]))Total Sales Amount = CALCULATE(SUM(Sales[SalesAmount]))
Shows sales grouped by product - Slicer: Category Filter
Based on Products[Category]
Relationship Setup: Single direction from Products to Sales on ProductID by default.
Cross-filtering: Changing relationship direction to both directions allows filtering from Sales to Products and vice versa.
+----------------------+--------------------------+ | KPI Card | Category Slicer | | Total Sales Amount | | +----------------------+--------------------------+ | Product Sales Details Table | | | +--------------------------------------------------+
The Category Slicer filters the Product Sales Details Table by product category. Because the relationship is single direction from Products to Sales, filtering by category affects sales data shown in the table.
If the relationship direction is changed to both directions, selecting a product or sales amount in the table can filter the slicer and other visuals, enabling two-way filtering.
Task: Add a filter selecting the category Furniture in the Category Slicer.
Question: Which products and sales amounts appear in the Product Sales Details Table, and what is the updated Total Sales Amount in the KPI Card?
Answer: The table shows only products in Furniture category: Chair, Desk, and Lamp. Sales amounts for these products are 450 (Chair) + 500 (Desk) = 950. The KPI Card updates to show Total Sales Amount = 950.
Practice
Single relationship direction mean in Power BI?Solution
Step 1: Understand relationship direction
Single direction means filter context flows from one table to another, but not back.Step 2: Compare with both directions
Both directions allow filters to flow both ways, unlike single direction.Final Answer:
Filters flow from one table to another in only one direction. -> Option DQuick Check:
Single direction = one-way filter flow [OK]
- Confusing single with both directions
- Thinking filters flow both ways in single direction
- Assuming no filters flow in single direction
Solution
Step 1: Recall correct DAX syntax for relationship direction
Power BI uses CROSSFILTER keyword with values Single or Both to set filter direction.Step 2: Identify correct option
CROSSFILTER(Table1[ID], Table2[ID], Both) uses CROSSFILTER Both which is the correct syntax for both directions.Final Answer:
CROSSFILTER(Table1[ID], Table2[ID], Both) -> Option AQuick Check:
Relationship direction syntax uses CROSSFILTER Both [OK]
- Using DIRECTION keyword instead of CROSSFILTER
- Misspelling Both as BothDirection or BothDirections
- Confusing syntax with SQL JOIN
Solution
Step 1: Understand filter flow in single direction relationship
Filter flows from Customers to Orders, but not from Orders back to Customers.Step 2: Apply filter on Orders table
Filtering Orders by product affects Orders only; Customers table remains unfiltered.Final Answer:
The Orders table is filtered, but Customers table remains unfiltered. -> Option BQuick Check:
Single direction filters one way only [OK]
- Assuming filter flows both ways
- Thinking Customers table filters Orders only
- Confusing filter direction with cross-filtering
Solution
Step 1: Check relationship activation status
Inactive relationships do not apply filters even if direction is Both.Step 2: Confirm relationship direction and keys
Direction Both is set, and keys exist, so inactive status is the issue.Final Answer:
The relationship is inactive and needs to be activated. -> Option AQuick Check:
Inactive relationship blocks filter flow [OK]
- Assuming direction is wrong without checking activation
- Ignoring inactive relationships
- Thinking cross-filtering is a global setting
Solution
Step 1: Analyze existing relationships and filter flow
Customers filters Orders, Products filters Orders, but no direct filter flow from Customers to Products.Step 2: Understand why filtering Customers does not filter Products
Because Orders to Products filters from Products to Orders, filter does not flow from Orders to Products.Step 3: Use DAX with CROSSFILTER to simulate filter flow
Using CROSSFILTER in measures can override filter direction temporarily to enable filtering Products by Customers.Final Answer:
Use DAX measures with CROSSFILTER to simulate filter flow from Customers to Products. -> Option CQuick Check:
Use CROSSFILTER in DAX for complex filter flow [OK]
- Changing all relationships to Both can cause ambiguity
- Creating unnecessary direct relationships
- Assuming filter flows automatically through multiple single directions
Ready to prove it?
Pass the test and this pattern moves unknown
