In Power Query, to merge two tables while maintaining a one-to-many relationship without duplicating any data, we must proceed with the best practices:
1. Select the Correct Join Type
Left Outer Join: This keeps all records from the primary(one side) table with only matching records from the related(many side) table.
Avoid Directly Expanding the Nested Table Instead: If there are multiple matches on the many side tables, expanding will duplicate rows.
2. Merge Without Duplicating Data
Invoke the Merge Queries option in Power Query:
Navigate to Home→ Merge Queries.
Select the key column in both of the tables that define the relationship.
Select Left Outer Join so that all records from the primary table will be kept.
Expand Cautiously- Instead of expanding all columns, keep the related table as a nested table and perform aggregations like SUM, COUNT, or TEXT.COMBINE.
3. Perform an Aggregate instead of Row Expansion
After the merge, click to expand and select the option to Aggregate instead of Expand All:
a) Use either SUM or AVERAGE for numeric fields;
b) Use TEXT.COMBINE for concatenation of text values;
c) Use COUNT to count the number of related records.
4. Alternative: Create a Lookup Table instead of Merging
If you only need to reference data without actually adding rows, consider creating a Lookup Table and making use of RELATED() via DAX rather than merging this in Power Query.