I have a database that tracks parts loans and payback to multiple organizations in my company. I have a query that for a given customer and part name should show a sum of how many have been loaned out (may have been multiple loans), the sum of how many have been paid back (may have been multiple paybacks) and a calculated field that takes the difference of the two. The sum in RcvdQTY is not calculating correctly. In the example in the screenshot below it should be Rcvd = 72, Paid Back = 72, Balance = 0 but it reads 648, 72, 576

Screenshot of my query below:
[![enter image description here](https://i.stack.imgur.com/1Jarm.jpg)](https://i.stack.imgur.com/1Jarm.jpg)

As requested here is my SQL for the query:

```
SELECT CustomerT.CustomerProgram, PartsT.PartName, PartsT.IndiaUID, PartsT.NSN, Sum(DiversionT.RcvdQTY) AS SumOfRcvdQTY, Sum(PaybackT.PayAmountParts) AS SumOfPayAmountParts, Sum([RcvdQTY]-[PayAmountParts]) AS BalanceOwed
FROM SupplierT 
INNER JOIN (PayMethodT 
INNER JOIN ((PartsT 
INNER JOIN (CustomerT 
INNER JOIN DiversionT 
ON CustomerT.CustomerID = DiversionT.CustomerID) 
ON PartsT.PartID = DiversionT.PartID) 
INNER JOIN PaybackT 
ON (PartsT.PartID = PaybackT.PartID) AND (CustomerT.CustomerID = PaybackT.CustomerID)) 
ON (PayMethodT.PayMethodID = PaybackT.PayMethodID) AND (PayMethodT.PayMethodID = DiversionT.PayMethodID)) 
ON SupplierT.SupplierID = DiversionT.SupplierID
GROUP BY CustomerT.CustomerProgram, PartsT.PartName, PartsT.IndiaUID, PartsT.NSN
HAVING (((CustomerT.CustomerProgram)="M777 Australia") AND ((PartsT.PartName)="CSD-R"));

```