### Title

Get a summary calculation based on certain criteria

### Post

Hello,

I am stuck on something. I have a layout that has general customer information. On the layout is a portal (sourced to a different related table that pulls up items to put in the portal). Below is a basic example of entries that could be made on the portal (pretend each word is a field entry and each line is a portal line entry):

Product A Series 2 $5.00

Product A Series 8 $10.00

Product B Series 6 $7.00

Product A Series 3 $3.00

I have a calculation set already to get the total of the portal dollar amount (in this case it would be $25.00).

What I am trying to get is a summary of only certain items in the portal. For example, I want to know the total dollar amount for all Product A entries in the portal (so in this case it would be $18.00).

I have a separate calculation field for all three of my product types (ex: Product A, Product B, and Product C). What I have set isn't working though.

For instance, my Product A field is set with a calculation of: If (Product::Product Type = "Product A"; Sum (Product::Amount))

All it returns is the value of the first portal line item for Product A ($5.00), not the total of all portal line items for Product A ($18.00).

Any thoughts on where I might be going wrong? I keep tweaking at it but seem to get farther away from my goal.

Thank you!

You only got part way there. ;-)

The individual calculation fields you just created have to be summed by sum calculations defined in the Customer table.

When you put a field from a related table on a layout without putting it inside a portal, it refers to the "first" related record. If that first related record is not Product Type A, it will be empty, which is just what you set it up to do, but not what you wanted it to do. ;-)

If you define three calculations in customer: cTotalProdA, cTotalProdB, and cTotalProdC

defined as Sum ( Products::Product

AAmount Calculation ), Sum ( Products::Product A Amount Calculation ), and Sum ( Products::ProductCAmount Calculation ) respectively,You can then put cTotalProdA, cTotalProdB, and cTotalProdC on your customer layout to see the totals for each product type for the current customer.