Locked lesson.
About this lesson
Armed with the technique on fixing our Many-To-Many join problem, it's time to apply it in our sample model.
Exercise files
Download this lesson’s related exercise files.
Solving Many-To-Many Joins with Bridge Tables - Practice.xlsx706.5 KB Solving Many-To-Many Joins with Bridge Tables - Practice - Completed.xlsx
731.3 KB
Quick reference
Solving Many-To-Many Joins with Bridge Tables - Practice
Bridge tables allow us to create separate tables with unique keys in order to link tables via One to Many relationships.
When to use
When you are trying to create relationships between tables, but both tables have many repeating values in the columns you wish to use for the relationship.
Instructions
Create a Staging Query
- Edit the Power Query that creates the table which has been loaded to Power Pivot
- Make sure that the final step of the query is to set the data type for each column
- Right click on the final step --> Extract Previous
- Name the new query “Staging – “ and the original table name
- Close and load the query as a connection only, but do not choose to load it to the data model
Create the new Dimension table:
- Create a new query by referencing the newly created Staging query
- Select the column(s) you wish to keep --> right click --> Remove Other Columns
- Right click the column you wish to use as the “one” side of the relationship -> Remove Duplicates
- Rename the table with a descriptive name
- Load the new table to the Data Model
Edit the Original query
- If you kept more than one column when creating your new Dimension table, remove the additional columns from the original table
Create the relationships:
- Link the new table to each of the original tables (not the staging query tables)
- Hide the relationship field on the Many side of the relationship
Hints & tips
- If there could be values in each table to be linked that don’t appear in the other, it may be a good idea to create two staging queries, append them, and then remove duplicates again to create your dimension. This way you will ensure you always have all entries in the bridge table
- This technique can be combined with the Composite Key technique covered in the Solving Many-To-Many Joins with Composite Keys section
Lesson notes are only available for subscribers.