# Cumulated sum

The cumulated sum step enables you to calculate running totals based on a reference column, typically dates. It's valuable for understanding accumulation over time and visualizing progressive totals.

### Step parameters

* `Columns to cumulate` **tuples({column; string})\***: the value columns you want to compute the cumulated sum of, and for each one the name of the result column (by default it will be your original column name suffixed by `_CUMSUM`).
* `Reference column to sort (usually dates)`**column(string)**: the column that will be used to order rows in ascending order. Usually you will use a date column here (to compute a year-to-date result for exemple).
* `Group By` **(string)** **(optional)**: if you need to apply the cumulated sum computation by group of rows, you may specify here the columns to be used to constitute groups.

### Example

**Input**

<figure><img src="https://1809014303-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZxYYf1KpgarKMgMsDCrw%2Fuploads%2Fgit-blob-0de472c0674034871dd84e755df657f93878a765%2Fcumsum_input.png?alt=media" alt=""><figcaption><p>Compute - Cumulated sum input</p></figcaption></figure>

**Configuration**

```json
{
    "cumul_columns": [
        {"sales": "cumulative_sales"},
        {"quantity": "cumulative_quantity"}
    ],
    "ref_column": "sales",
    "group_by": []
}
```

**Output**

<figure><img src="https://1809014303-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZxYYf1KpgarKMgMsDCrw%2Fuploads%2Fgit-blob-ae5a4cc874a6e9d43dbefd766cb0ee8298358736%2Fcumsum_output.png?alt=media" alt=""><figcaption><p>Compute - Cumulated sum output</p></figcaption></figure>
