|
|
|
---
|
|
|
|
title: 'Rollup'
|
|
|
|
description: 'This article explains how to create & work with a Rollup field.'
|
|
|
|
tags: ['Fields', 'Field types', 'Links based types', 'Rollup']
|
|
|
|
keywords: ['Fields', 'Field types', 'Links based types', 'Rollup', 'Create rollup field']
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
`Rollup` fields are used to aggregate data from fields in the related table. Often used to calculate totals, averages, and other aggregate data.
|
|
|
|
|
|
|
|
## Create a Rollup Field
|
|
|
|
1. Click on `+` icon to the right of `Fields header`
|
|
|
|
2. On the dropdown modal, enter the field name (Optional).
|
|
|
|
3. Select the field type as `Lookup` from the dropdown.
|
|
|
|
4. Select the link field from the dropdown. This is the field that links the current table to the related table.
|
|
|
|
5. Select the field for display from the dropdown. This is the field that will be displayed in the current table.
|
|
|
|
6. Select the aggregation function from the dropdown. This is the function that will be used to aggregate the data.
|
|
|
|
7. Click on `Save Field` button.
|
|
|
|
|
|
|
|
![image](/img/v2/fields/types/rollup.png)
|
|
|
|
|
|
|
|
### Aggregation Functions
|
|
|
|
Here's a table with brief descriptions for each of the aggregation functions supported by NocoDB:
|
|
|
|
|
|
|
|
| Aggregation Function | Description |
|
|
|
|
|----------------------|---------------------------------------------------------|
|
|
|
|
| Count | Counts the number of records in a dataset. |
|
|
|
|
| Minimum | Retrieves the minimum value from a dataset. |
|
|
|
|
| Maximum | Retrieves the maximum value from a dataset. |
|
|
|
|
| Average | Calculates the average value in a dataset. |
|
|
|
|
| Sum | Adds up all the values in a dataset. |
|
|
|
|
| Count Distinct | Counts the number of distinct values in a dataset. |
|
|
|
|
| Sum Distinct | Adds up all the distinct values in a dataset. |
|
|
|
|
| Average Distinct | Calculates the average of distinct values in a dataset. |
|
|
|
|
|
|
|
|
## Similar links-based fields
|
|
|
|
- [Links](010.links.md)
|
|
|
|
- [Lookup](020.lookup.md)
|