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
learner03
Post Partisan
Post Partisan

Merging tables query

I have below 2 tables-SO and SO_lines

I want the output table as such that the new table should only contain those SO that are in SO table and the quantity column should be the the sum of only quantities of those items that are in SO table. I do not want the items that do not belong to SO table.

   
Table SO   
   
JobID  
A  
B  
C  
D  
   
Table SO_lines 
   
JobIDItemQuantity
A12340
A456100
A78945
A32123
B12354
B45654
B76532
C12312
C32154
C45623
D98787
D123122
E12343
F45623

OUtput-items and quantites of only those who are in SO table-

Output Table
  
itemQuantity
123228
456177
78945
32177
76532
98787

 

1 ACCEPTED SOLUTION
sevenhills
Super User
Super User

Assuming your relatioship is like this

sevenhills_0-1643251019399.png

 

Create a table as

 

sevenhills_2-1643251059467.png

 

Add filter 

sevenhills_3-1643251124116.png

 

Your output will be 

sevenhills_1-1643251038145.png

 

 

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
sevenhills
Super User
Super User

Assuming your relatioship is like this

sevenhills_0-1643251019399.png

 

Create a table as

 

sevenhills_2-1643251059467.png

 

Add filter 

sevenhills_3-1643251124116.png

 

Your output will be 

sevenhills_1-1643251038145.png

 

 

@sevenhills how can I do the same in Power query?

For Power Query, 

 

a) Using Merge Queries - inner join type
a) 1) Check this link https://docs.microsoft.com/en-us/power-query/merge-queries-inner

a) 2) As per the link, your right table for merge is "Table SO"

a) 3) Join Kind is Inner Join

a) 4) You dont need to expand for any right table columns 

a) 5) remove unwanted columns

 

b) Select the column "item" , click group by Quantity

https://docs.microsoft.com/en-us/power-query/group-by 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

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

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.