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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Olwin
Frequent Visitor

Sum from another table

Hi there,

 

I have a table relation like below:

1. Location (Loc Code)

2. Item (Item Code)

3. Shipment Planning (Planning No, Loc Code, Item Code, Quantity)

  • Relationship with Location = Many-to-One (Location.Loc Code = ShipmentPlanning.Loc Code)
  • Relationship with Item = Many-to-One (Item.Item Code = ShipmentPlanning.Item Code)

4. Order Lines (Order No, Item Code, Loc Code)

  • Relationship with Location = Many-to-One (Location.Loc Code = OrderLines.Loc Code)
  • Relationship with Item = Many-to-One (Item.Item Code = OrderLines.Item Code)

 

My goal is to show total "Quantity" from "Shipment Planning" for each "Order Line" with the same Item and Location.

Kindly please help 😊

Thanks.

 

Sample Data

Location (A & B)

Item (X1 & X2)

Shipment Planning

Shipment Planning NoItemLocationQuantity
SP#01X1A10
SP#02X2A20
SP#03X1B30
SP#04X1A17

 

Order Lines

Order NoItemLocationTotal Shipment Planning
SO#01X1A27
SO#02X2A20
SO#03X1A27
SO#04X1B30
1 ACCEPTED SOLUTION
speedramps
Super User
Super User

Download this exampl PBIX solution from Onedrive

Click here 

speedramps_0-1738672809414.png

 

speedramps_1-1738672858441.png

 

 

Please click thumbs up for the suggestion,

and click [accept solution] if it works.

 

Your question is a bit vague, always provide an example desired output to clarify what is required.

 

 

View solution in original post

6 REPLIES 6
speedramps
Super User
Super User

Download this exampl PBIX solution from Onedrive

Click here 

speedramps_0-1738672809414.png

 

speedramps_1-1738672858441.png

 

 

Please click thumbs up for the suggestion,

and click [accept solution] if it works.

 

Your question is a bit vague, always provide an example desired output to clarify what is required.

 

 

Hi @speedramps  I have see your given example file, and found that the key to get correct result is the selection of "Item No."

 

Previously, I show "Item No." in my visual from my "Order Lines" table, but after I change the source table for "Item No." from Item table, the total is correct automatically.

 

Thanks for your help 😊

@Olwin thank you.

Yes you understand correctly.

 

That is why I provide a diagram of the relationships and highlighted in red which fields you needed to select from which tables to use those relationships correctly.

 

 

For me the joy cones from not just giving a solution but teaching the method.

 

Well done on learning it!

Bibiano_Geraldo
Super User
Super User

Hi @Olwin ,

To achieve your goal, you need to create a measure to look like this:

TotalShipmentPlanning = 
CALCULATE(
    SUM('Shipment Planning'[Quantity]),
    FILTER(
        'Shipment Planning',
        'Shipment Planning'[Item] = SELECTEDVALUE('Order Lines'[Item]) &&
        'Shipment Planning'[Location] = SELECTEDVALUE('Order Lines'[Location])
    )
)

 

Expected Output:

Bibiano_Geraldo_0-1738672929747.png

Please see attached file

parry2k
Super User
Super User

@Olwin BTW, here is the output of the solution.

 

parry2k_0-1738672576021.png

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@Olwin see the attached solution, in nutshell, you need the following two measures:

 

Planning Qty = SUM ( ShipmentPlanning[Quantity] )

Total Shipment Planning = 
SUMX ( 
    SUMMARIZE (     
        OrderLines,
        'Item'[Items],
        Location[Location],
        "@Planning Qty", [Planning Qty]
    ), 
    [@Planning Qty] 
)

 

 

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.