Cross-filter an unrelated table with another table in Power BI. The DAX functions used are TREATS or CROSSFILTER, and another option is to create a bridge table. All of these methods give the correct filtering when direct relationships do not exist.
The first approach: Bridge Table:
Create a Bridge Table:
Create a unique list of all possible bridging keys to serve as a bridge table if both of the two tables share the same common key (ProductID in Sales and Inventory tables).
Here is how to create a new table in Power BI using DAX:
BridgeTable = DISTINCT(UNION(VALUES(Sales[ProductID]), VALUES(Inventory[ProductID])))
-
Establish Relationships:
-
Enable Cross-Filtering:
Approach 2: Using TREATAS for Dynamic Filtering
-
Create a Measure:
Filtered Sales =
CALCULATE(
SUM(Sales[Amount]),
TREATAS(VALUES(Inventory[ProductID]), Sales[ProductID])
)
-
Dynamic Behavior:
Approach 3: Using CROSSFILTER for Relationship Control
-
Direct Relationship Adjustment:
CrossFiltered Sales =
CALCULATE(
SUM(Sales[Amount]),
CROSSFILTER(Sales[ProductID], Inventory[ProductID], Both)
)
-
Resolve Filter Issues: