> ## 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 MaxNBy aggregates

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

This aggregate combines the aggregates generated by other `max_n_by`
aggregates and returns the maximum values and associated data found
across all the aggregated data.

## Arguments

The syntax is:

```sql theme={"dark"}
rollup(
    agg MaxNBy
) MaxNBy
```

| Name  | Type   | Default | Required | Description                   |
| ----- | ------ | ------- | -------- | ----------------------------- |
| `agg` | MaxNBy | -       | ✔        | The aggregates being combined |

## Returns

| Column | Type   | Description                                       |
| ------ | ------ | ------------------------------------------------- |
| rollup | MaxNBy | An aggregate over all of the contributing values. |

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