---
title: rollup() | Tiger Data Docs
description: Combine multiple MaxNBy aggregates
---

Since [1.16.0](https://github.com/timescale/timescaledb-toolkit/releases/tag/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:

```
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. |
