I am attempting to 'SUMIF' a table column (if it were excel - but it isn't).

I want to create a calculation that **SUMS ALL RECORDS THAT MATCH A CRITERIA**

Table to Calculate:

TABLE NAME: **TRANSACTIONS**

From | Amount |
---|---|

Customer | 10 |

Agent | 5 |

Agent | 20 |

Customer | 10 |

Customer | 20 |

Customer | 10 |

What is the calculation formula to 'SUM' the TRANSACTIONS::Amount where the TRANSACTIONS::From = "Customer" ?

Currently, in the Transactions table I have a summary field to 'SUM' the totals of the Amount column.

In the table where I want the calculation to output, so far I have tried 'If', 'Sum', 'Case', 'GetSummary'.

Can someone help??

you have at least 2 options:

- go to your transactions layout, do a find with From = customer, grab the value of your summary field into a $$var and bring it to your context;

- use ExecuteSQL( "SELECT SUM(Amount) FROM transactions WHERE \"FROM\" = ?"; "";""; transactions::customerID)