> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://staging.chrisp.chat/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# How do I use advanced custom calculations in Javascript?

Advanced custom calculations enable users to create more complex calculations using javascript. Below are examples of notation you can use to create calculations of varying complexity:

1. Sum: this enables users to compute the sum of an indicator.

```
sum(data.values.[indicator])
```

2. Cumulative sum: this enables users to create a column which displays the cumulative totals for the chosen dimensions.

```
cumulativeSum(data.values.[indicator])
```

3. Difference: enables users to calculate the difference between two adjacent rows.

```
differenceFromPrevious(data.values.[indicator])
```

4. Reading dimensions: this enables users to create analyses which references the text within a dimension field.

```
valuesWithDimension(data.values.[indicator], 'DimensionId', DimensionId)
```