Working with the Rollup field

The Rollup field performs calculations (like sum, average, or count) on a set of linked records, summarizing data from another table.

This guide covers what a Rollup field is and a clear example of its use, how a rollup differs from a Lookup or Count field, and how to create and configure a Rollup field.

What is a Rollup field?

A Rollup field works after you have already set up a Link-to-table field. While a Lookup field pulls one piece of data (like an email), a Rollup field performs a calculation on all the linked records.

This field is read-only, meaning you cannot edit the value directly. It’s an automatic calculation that updates whenever the data in the linked records changes.

How to create a Rollup field

Prerequisite

You must have an existing Link-to-table field in your table before you can create a Rollup field.

Steps

  1. In your table, add a new field.
  2. Input a name for your field (e.g., “Total Spent” or “Average Rating”).
  3. Select Rollup from the field type dropdown menu.
  4. In the configuration panel, you must select three things:
    • Select a link row field: Choose the Link-to-table field you want to use.
    • Select a field to rollup: Choose the specific field from the linked table that you want to calculate (e.g., Order Amount).
    • Select a rollup function: Choose the calculation you want to perform (e.g., sum).
  5. Click Create.

The new read-only field will now be populated with the result of your calculation.

Configuring a new Rollup field in Baserow

Rollup functions

Rollup fields can perform a variety of calculations. The function you choose must be compatible with the field type you are rolling up (e.g., you can only sum a number field).

Function Description Usable Field Type(s)
sum Adds all values together. Number
avg Calculates the average of all values. Number
count Returns the total number of linked items. Any
max Returns the highest value. Number, Date, Text
min Returns the lowest value. Number, Date, Text
any Returns true if any linked boolean is true. Boolean
every Returns true if all linked booleans are true. Boolean
stddev_sample Sample standard deviation. Number
stddev_pop Population standard deviation. Number
variance_sample Sample variance. Number
variance_pop Population variance. Number

Example: Customers and Orders

This is the best way to summarize related data. Imagine you have two tables, you want to see the total amount of money each customer has spent, directly in your Customers table.

  1. Customers: Contains Customer Name.
  2. Orders: Contains Order ID, an Order Amount (a number field), and a Link-to-table field called [Link] Customer.

Solution: In your Customers table, you would create a Rollup field named “Total Spent”:

  • Link-to-table field: Choose the [Link] Customer field.
  • Field to rollup: Choose the Order Amount field from the Orders table.
  • Rollup function: Select sum.

The “Total Spent” field will now automatically calculate and display the sum of all linked orders for each customer (e.g., “$150.00”).

Frequently asked questions

What’s the difference between a Rollup, Lookup, and Count field?

They all use the Link-to-table field, but for different jobs:

  • Link-to-table: Creates the relationship (links ‘Order’ to ‘Customer’).
  • Lookup: Displays data from a linked record (shows the ‘Customer’s Email’).
  • Count: Counts the number of linked records (shows ‘3 Orders’).
  • Rollup: Performs a calculation on the linked records (shows the sum of ‘Order Amount’).

What’s the difference between the rollup count function and a Count field?

They produce the exact same result. The Count field is just a dedicated, simpler field for this one purpose. The Rollup field’s count function is one of many options available.

Why can’t I edit a Rollup field?

It’s a read-only field that displays the result of a calculation. To change the value, you must change the data in the underlying linked records (e.g., add a new order, or change an order’s amount).


Still need help? If you’re looking for something else, please feel free to make recommendations or ask us questions; we’re ready to assist you.