# Find the Sum of a Repeated Variable

### From HotDocs Wiki

When Number variables are used in repeated dialogs, you can use the SUM expression to add repeated number values. For example, if a repeated dialog is used to gather information about an individual's credit card balances, a computation can add the balances together to find the total amount owed.

In addition, you can use the SUM expression in a computation script to add computation values that have been repeated.

In the following example, let's say you have a repeated dialog that contains three variablesâ€” *Item*, *Item Amount*, and *Item Quantity*. For each line item, you create a fourth variable, a computation called *Total Amount* that multiplies *Item Amount* by the number of items the user purchases (or *Item Quantity*). You can then add all of the *Total Amount* values and receive one sum total.

## Example

//Example 1: Sum of a repeated Number variable. SUM( Num Var ) //Example 2: Sum of a repeated Computation variable. SUM( Total Amount )

Num Var | A Number variable in a repeated dialog. |

Item Amount | A Number variable in a repeated dialog. |

Item Quantity | A Number variable in a repeated dialog. |

Total Amount | A Computation variable that multiplies two repeated variables in its script (for example, Item Amount * Item Quantity). |