Skip to content

Rollup fields: arithmetic across a link

Sum, count, average, earliest or latest across every linked record, derived at read time so the number can't drift. The five aggregations and their guards.

Updated November 2026

A rollup answers a question about the records on the other end of a link: how many, how much, the smallest, the latest. The demo shop's Customers table has Total spent, which is the sum of each customer's order totals, and its Orders table has Items, a count of the linked plants. Nobody maintains either number.

Make one

Like a lookup, a rollup works through a link, and the link must exist first.

  1. Add a field and choose Rollup.
  2. In Through, pick the link to aggregate across.
  3. In Field, pick the linked field to aggregate. A plain count needs none, because it counts linked records, not values.
  4. In Aggregation, pick one of Sum, Count, Minimum, Maximum or Average. Sum and Average need a number field. Minimum and Maximum take a number or a date, and on a date field they read Earliest and Latest.

If you leave the name blank, the rollup is named after what it does, for example Sum of Nights (from Bookings), Count of Bookings or Earliest of Check-in (from Bookings). The aggregation comes first so that a sum and an average of the same field through the same link get different names. Otherwise both would want the same name, and a trailing 2 would be all that told them apart.

An optional condition, "Only linked records that match feed this rollup", narrows the input. Sum of order totals, but only paid orders takes one rule. Number rollups also have their own decimals and thousands-separator settings, so an average doesn't have to use its source's whole-number formatting. They write their figures the way the field they read does, so a sum of 1.234,56 amounts reads 1.234,56 too.

All of this can be edited later. Swapping Sum for Average is an ordinary edit.

The type follows the aggregation

Count, Sum and Average always produce a number. Minimum and Maximum keep the aggregated field's own kind. The minimum of a number is a number, the earliest of a date is a date, and filters treat it as one. Presentation is kept too, so a sum of a currency field reads as currency.

Rollups of rollups, lookups and formulas

The field a rollup adds up can be worked out too: another rollup, a lookup or a formula on the linked table. A Clients table can show each client's Total paid as the sum of every project's own Total paid, which is itself the sum of that project's payments. It can also add up a Balance that each project works out with a formula from its payments and expenses.

A rollup of a lookup reads every value the lookup shows. If each project looks up the amounts of its payments, a client's Largest payment can be the maximum of all of them, across all of that client's projects.

A chain like this can reach up to three tables away. Regions → Clients → Projects → Payments is three links, and Tabla refuses a fourth when you save and names the tables it would pass through. It also refuses a chain that would loop back to itself, such as a client total that reads a project field that reads that same client total, and names the fields in the loop.

The rollup takes its formatting from the field at the end of the chain, so a sum of each project's sum of euro payments reads in euros. Sorting, filtering, grouping and the footer all work on it the same way they do on a rollup of a plain field.

Computed on every read

A rollup isn't stored. It's computed from the linked records every time it's read, so there is nothing to keep in sync. Edit a linked order and the customer's Total spent changes in any grid that has Customers open, with no syncing step that could lag or fail. The same is true two and three tables up a chain. Records in the trash drop out of the arithmetic immediately and count again if restored.

Two things follow from that:

  • An empty link cell reads 0 for a count and a sum, since a total of nothing is nothing. It reads blank for an average, earliest, latest, minimum or maximum, which have no answer without a value.
  • A number that must not change later, like the price you charged, should not be a rollup. A rollup always shows the answer as it is now, and an invoice needs the figure as it was. Store that one.

Read-only, filterable, groupable, sortable

Rollup cells are read-only on screen and refuse writes over the API, because there is no column to assign. You can filter by any rollup in views and API queries (Total spent greater than 100 works as a query), and a grid can group by one, such as customers by how many orders they've placed, with one section per number. Rollups also sort. "Guests, most nights first" is a sort on a Total nights rollup. A count or a sum is 0 for a record that links nothing, so it sorts with the zeros, and Total spent less than 100 finds it. An average over nothing is empty and sorts with the empties.

The deletion guard

A rollup depends on two things, and Tabla refuses, by name, to let you remove either one from under it:

  • Deleting the link it works through: Can't delete "Orders" — the lookup/rollup field "Total spent" rides this link. Delete "Total spent" first.
  • Deleting, or changing the type of, the field it aggregates. The refusal names the dependent the same way. That includes a rollup or formula in the middle of a chain. If a client total adds up each project's Total paid, the project's rollup can't be changed to show a date, and can't be deleted, until the client total is changed or deleted.

Delete or adjust the rollup first and you can then do either. The guard works from both sides of the link, so deleting the mirror field is refused too.

Over the API

A rollup reads under its own name as a plain value of its type:

"Orders": [
  { "id": "rec_ff374pj8sbhe", "display": "ORD-1041" },
  { "id": "rec_t23a89yecn4d", "display": "ORD-1052" }
],
"Total spent": 135

Its stored config (aggregation, the link and target field ids) is in the field's own JSON, so an integration can find out what the number means. See /docs/api.

When a lookup is the field you meant

If you're not aggregating, and you want to see the linked customer's email, not do arithmetic on it, use a lookup. Lookup vs rollup has a test for it: if deleting one linked record should change this value, it's a rollup.

About Tabla

Tabla is a no-code database with Postgres underneath. Every feature is on every plan, you get a million records per database, and you can export your whole database in one file any day.

More guides