Performing calculations on multiple records within a related table
Hello I have made a database with two tables: one containing customer info and order total and another that contains payments. Using portals this allows me to add many payments for each customer. The problem is that I now want to calculate the amount payable by subtracting the total of all payments from the order total, but cannot figure out exactly how to go about it as simply using a calculation only subtracts from one record(payment). I'm sorry if this question has been asked before or is painfully simple but I am a complete novice.
From the customer table define your calculation field and use the Sum function to compute the total payments from the portal. (This assumes an unfiltered portal. If it's filtered, we'll have to change this calculation.)
OrderTotal - Sum ( Payments::PaymentAmount )