Rollup

This article explains how to create & work with a 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 Rollup 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

Aggregation Functions

Here's a table with brief descriptions for each of the aggregation functions supported by NocoDB:

Aggregation FunctionDescription
CountCounts the number of records in a dataset.
MinimumRetrieves the minimum value from a dataset.
MaximumRetrieves the maximum value from a dataset.
AverageCalculates the average value in a dataset.
SumAdds up all the values in a dataset.
Count DistinctCounts the number of distinct values in a dataset.
Sum DistinctAdds up all the distinct values in a dataset.
Average DistinctCalculates the average of distinct values in a dataset.

Conditional Rollup

Rollup fields are used to perform calculations—such as sum, average, count—on linked records from a related table. By default, the rollup includes all linked records. However, you can fine-tune the results by including only those records that meet specific criteria.

To do this, enable the option: Only include linked records that meet specific conditions

This option allows you to apply filters to the linked records before the rollup calculation is performed. It’s particularly useful when you want to aggregate values conditionally—like summing revenue for a specific period or counting items that meet a threshold.

Applying filters

  1. Toggle ON Only include linked records that meet specific conditions.
  2. Click Add filter to define the condition(s) using fields from the related table.
  3. Use Add filter group to combine filters using AND/OR logic.
  4. Click Save Field to apply.