> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify-poc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# rollup()

> Combine multiple counter aggregates

<Icon icon="tag" iconType="duotone" /> Since [1.3.0][toolkit-1.3.0]

This function combines multiple counter aggregates into one. This can be used to combine aggregates from adjacent
intervals into one larger interval, such as rolling daily aggregates into a weekly or monthly aggregate.

## Arguments

The syntax is:

```sql theme={"dark"}
rollup(
    cs CounterSummary
) RETURNS CounterSummary
```

| Name | Type             | Default | Required | Description                                                    |
| ---- | ---------------- | ------- | -------- | -------------------------------------------------------------- |
| `cs` | `CounterSummary` | -       | ✔        | A counter aggregate created using [`counter_agg`][counter-agg] |

## Returns

| Column | Type           | Description                                                               |
| ------ | -------------- | ------------------------------------------------------------------------- |
| rollup | CounterSummary | A new counter aggregate created by combining the input counter aggregates |

[counter-agg]: /api-reference/timescaledb-toolkit/counters-and-gauges/counter_agg/counter_agg

[toolkit-1.3.0]: https://github.com/timescale/timescaledb-toolkit/releases/tag/1.3.0
