> For the complete documentation index, see [llms.txt](https://guides.noloco.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guides.noloco.io/data/collections/rollups.md).

# Rollup Fields

Learn more about Rollups

A rollup field is a summary of related fields. Choose a relationship on the same table, choose which field on the related table you need to summarize and then choose how to summarize it.

An example would be if you wanted to calculate the total cost of all projects that each client/company has in the above example. You would add a **rollup** field to the **Company** table with the **projects** relationship we defined earlier. The field to summarize would be **Cost** and you would want to **SUM** the costs, so you get the total sum of costs of all projects associated with a given company.

### Creating a rollup field

* Go to the table you would like to add the rollup field to. In the above example this is the **Company** table.
* Open the table settings sidebar
* Add a new field and choose **Rollup** as the type.
* Choose from one of the multi-relationship fields associated with your table
* Choose the field you would like to summarize on the other table
* Choose which method of aggregation you would like
* Optionally, [filter, sort or limit](/data/collections/filtering-sorting-and-limiting.md) which related records are included

{% @arcade/embed url="<https://noloco.share.arcade.software/share/SpCRrayYX5ZYISiukNj5>" flowId="SpCRrayYX5ZYISiukNj5" %}

### Summarizing only some of the related records

By default a rollup uses every related record. You can narrow that down — count only the **active** tasks on a project, or sum the value of the **5 biggest** deals — by adding a filter, a sort order or a limit to the field.

See [Filtering, Sorting & Limiting](/data/collections/filtering-sorting-and-limiting.md) for the full guide.

### Aggregation Types

| Aggregation Type | Description                                       |
| ---------------- | ------------------------------------------------- |
| SUM              | The sum of all non-empty numeric values           |
| COUNT            | The number of all non-empty values                |
| MAX              | The largest of all the non-empty numeric values   |
| MIN              | The smallest of all the non-empty numeric values  |
| AVERAGE          | The average of all the non-empty numeric values   |
| CONCATENATE      | Join all the text values into a single text value |
| AND              | True if all of the values are true and non-empty  |
| OR               | True if any of the values are true                |

### What about non-numeric types like Durations and Dates?

Aggregation of durations and dates will behave exactly as expected, where the sum of a duration field is the sum of all the times, and the min of a date field is the earliest date


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://guides.noloco.io/data/collections/rollups.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
