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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

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 carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.