> For the complete documentation index, see [llms.txt](https://docs.cohesiveapp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cohesiveapp.com/reference/workflow-documentation/templates/math-expressions.md).

# Math Expressions

Cohesive supports simple math expressions. Users can perform basic arithmetic with the operators `+`, `-`, `*` , and `/` on number fields.

### Basic Math

In the following example, let's assume that we have three number fields(`unitPrice`, `quantity`, and `tax`), and are looking to calculate a `totalCharge` field.&#x20;

If we wanted to calculate `totalCharge` as the (`unitPrice`\*`quantity`)+`tax`, we would put the following as the description for the `totalCharge` field (of type `math expression`). We can refer to other fields via the syntax `{{fieldName}}`, like in the example below.

```
{{unitPrice}} * {{quantity}} + {{tax}}
```

Note: if you intend to refer to a field that's within a `nested` field type, you need to append the `nestedFieldName_` to the field name. For example, let's say that we have the below example. In order to refer to `unitPrice`, we would refer to it as `item_unitPrice`

<figure><img src="https://1659501652-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgXnl6gX6OwfIRspyklk3%2Fuploads%2FmiO69GcYUa2jtDdeyVLk%2Fimage.png?alt=media&amp;token=98cc6c5a-e27f-43f6-a4f4-7556b84de8e4" alt=""><figcaption></figcaption></figure>

### Aggregating fields that are in a list

In some cases, you may have a list of items, and want to sum up or multiply together all the values in the list. For example, if we had an Excel table with four rows (that is represented as a `List` in Cohesive), you may want to sum up the values of a column for all four rows.

We provide 2 functions - `SUM` and `PRODUCT`. Continuing the example above, let's assume that we have a column called `unitPrice` within an `item` list that we're looking to sum or multiply.

Example 1: Description to sum all `unitPrice` values&#x20;

```
SUM(item_unitPrice)
```

Example 2: Description to cross-multiply all `unitPrice` values&#x20;

```
PRODUCT(item_unitPrice)
```

*Note: you do not need the double curly braces to refer to other fields inside `SUM` and `PRODUCT` functions. To refer to a field inside a list, simply prefix the field name with `listName_`*
