Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
SHDJason
Advocate II
Advocate II

How to model this in Power Query

Hi, I'm new to data modeling with Power Query so please forgive if this is rudimentary stuff. But I need some guidance.  

 

I have 2 tables.

 

Table 1 has products and sales.

 

Table 2 has products and returns.

 

Table 1 has products  = A, B, C

Table 2 has products = B, C, D

 

For products B and C, I want to show sales and returns.

For the other unique products, I want to show which do not match (i.e. A only has sales and D only has returns).

 

I have been doing this by appending the spreadsheets, then pivot and use the Nulls as the exceptions.  But this is not sustaible anymore. 

 

What is the best way to model this?  A many-to-many join? Or a product lookup table of some sort? 

 

What happens with the products also have categories?

 

Thanks for your help.

1 ACCEPTED SOLUTION
MattAllington
Community Champion
Community Champion

How about you append the 2 tables, but instead of pivoting the data, simple create a new column called "type". This new column will have the value "sales" or "returns". To do this, load both tables into power query one at a time. Add the new column for each table and hard code the correct value. Then append both tables. 

 

Assuming you then load this data to power pivot, you can then use a pivot table or measures to complete the process. This shape is preferable for power pivot anyway. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

View solution in original post

1 REPLY 1
MattAllington
Community Champion
Community Champion

How about you append the 2 tables, but instead of pivoting the data, simple create a new column called "type". This new column will have the value "sales" or "returns". To do this, load both tables into power query one at a time. Add the new column for each table and hard code the correct value. Then append both tables. 

 

Assuming you then load this data to power pivot, you can then use a pivot table or measures to complete the process. This shape is preferable for power pivot anyway. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors