About this lesson
You cannot build a Many-To-Many join in Power Pivot, so what do you do when your data is in a Many-To-Many format? In this module we will explore how to work through a specific Many-To-Many case using a Composite Key.
Download this lesson’s related exercise files.Solving Many-To-Many Joins with Composite Keys - Theory.docx
66.7 KB Solving Many-To-Many Joins with Composite Keys - Theory - Solution.docx
Solving Many-To-Many Joins with Composite Keys - Theory
An overview of creating composite keys to deal with Many to Many join issues.
When to use
When one of your tables has two (or more) columns with repeating values which, when joined, create a unique value.
Creating a Composite Key column
For each table you wish to join:
- Edit your query in Power Query
- Select the columns you wish to merge together
- Go to Add Column --> Merge
- Choose to use a separator (such as a dash)
- Rename the column as desired
Using a Composite Key column
- Ensure you have a Composite Key column on both tables to be linked
- Ensure that the Composite Key column on one of the tables contains unique values
- Link the tables together using the Composite Key columns
- Hide the field on the Many side of the relationship (the side with the *)
Hints & tips
- To keep the original columns along with the new column, use the Merge operation in the Add Column tab instead of in the Transform tab
- Remember that the order in which the columns are selected is the order in which the data will appear in the new column
- It is recommended that the composite key field be hidden from all tables, as it is one that will never be used in the Pivot Table
- To ensure a column contains unique values in Power Pivot, use the Remove Duplicates feature on the column in Power Query
- This technique can work well on its own but may also be used in conjunction with bridge tables, covered in the section on Solving Many to Many Joins with Bridge Tables
Lesson notes are only available for subscribers.