# SUM

### Description

`SUM` adds all the values you provide in between a set of brackets, each separated by a comma, and returns the result.

`SUM` can also return the added total of values in a single list that is produced by another function.

### Example: Multiple values

```
p is Person
SUM(p.base_fee, p.transaction_fee, p.report_fee)
```

This [expression](https://docs.atfinity.io/rule-language/expressions) calculates the total of the base fee, the transaction fee, and the report fee regarding a person in a [case](https://docs.atfinity.io/guides/glossary/case).

### Example: From single list of properties

`SUM` can also return the added total of values in a single list that is produced by another function.

```
SUM(get_properties_from_instances(instances(AccountHolder), personal_income))
```

This expression works in a couple of steps to bring you the result:

* `SUM( .... )` is the overarching function, of which you want the result. In between its brackets sits another function.
* `get_properties_from_instances(.......)` is the function inside the `SUM` brackets, which goes and fetches the property of the instances you specify. For more information see also [get\_properties](https://docs.atfinity.io/rule-language/operators/special-operators/get-properties-from-instances).
* `instances(AccountHolder, personal_income)` returns the personal income of all the accountholders.
* These three combined, give you the sum total of the personal incomes for all the accountholders in the case.
