Forum Discussion
Many to many
I have 2 table it connect with many to many relationship for that without create bridge table i need to connect the table is there any alternative feature available please guide me
- Anonymous2 years ago
Hello, there are two types of models-
Composite ModelsComposite models allow you to combine data from multiple data sources in a single model. This feature enables you to have multiple relationships between tables without the need for a bridge table.
Bidirectional Cross-Filtering
Bidirectional cross-filtering enables filter context to flow in both directions of a relationship. This is useful in many-to-many relationships as it allows both tables to filter each other.
Imagine you have two tables: Sales and Products.
Sales Table:
SalesID
ProductID
Quantity
SalesDate
Products Table
ProductID
ProductName
Category
Steps:
Import both Sales and Products tables.
In the "Model" view, create a relationship between Sales[ProductID] and Products[ProductID].
In the relationship settings, set the "Cross filter direction" to "Both."
Example in Power BI
Here is a practical example with some DAX formulas and visualizations:
Step 1: Import Data
- Load 'Sales' and 'Products' tables.
Step 2: Create Relationship
Go to the "Model" view.
Create a relationship: Sales[ProductID] to Products[ProductID] Set "Cross filter direction" to "Both."
Step 3: Create Measures
Create some DAX measures to analyze the data:
Total Sales = SUM(Sales[Quantity])
Unique Products = DISTINCTCOUNT(Products[ProductID])
Step 4: Create Visuals Create a bar chart to show Total Sales by ProductName. Create a slicer for Category from the Products table.
Using composite models and bidirectional cross-filtering in Power BI allows you to connect two tables with a many-to-many relationship without needing a bridge table. This method simplifies your data model and enhances filtering capabilities.
1 Reply
- AnonymousNot applicable
Hello, there are two types of models-
Composite ModelsComposite models allow you to combine data from multiple data sources in a single model. This feature enables you to have multiple relationships between tables without the need for a bridge table.
Bidirectional Cross-Filtering
Bidirectional cross-filtering enables filter context to flow in both directions of a relationship. This is useful in many-to-many relationships as it allows both tables to filter each other.
Imagine you have two tables: Sales and Products.
Sales Table:
SalesID
ProductID
Quantity
SalesDate
Products Table
ProductID
ProductName
Category
Steps:
Import both Sales and Products tables.
In the "Model" view, create a relationship between Sales[ProductID] and Products[ProductID].
In the relationship settings, set the "Cross filter direction" to "Both."
Example in Power BI
Here is a practical example with some DAX formulas and visualizations:
Step 1: Import Data
- Load 'Sales' and 'Products' tables.
Step 2: Create Relationship
Go to the "Model" view.
Create a relationship: Sales[ProductID] to Products[ProductID] Set "Cross filter direction" to "Both."
Step 3: Create Measures
Create some DAX measures to analyze the data:
Total Sales = SUM(Sales[Quantity])
Unique Products = DISTINCTCOUNT(Products[ProductID])
Step 4: Create Visuals Create a bar chart to show Total Sales by ProductName. Create a slicer for Category from the Products table.
Using composite models and bidirectional cross-filtering in Power BI allows you to connect two tables with a many-to-many relationship without needing a bridge table. This method simplifies your data model and enhances filtering capabilities.