# Rollups

With rollups, you can aggregate values from related records — like issues, contacts, opportunities, tasks, projects, and custom objects — up onto a parent account or object. A rollup is a custom field whose value is calculated from a set of child records that match a filter you define.

Rollups can be any data type compatible with the chosen calculation, and are usable across the product anywhere custom fields are, including in views, triggers, the API, etc.

#### Configuration

Each rollup is defined by:

* **Object** — the related record type to roll up (issues, contacts, opportunities, tasks, projects, or a custom object).
* **Relationship** — which relationship on the parent to follow to find the related records.
* **Field** *(optional)* — the field on the related record to summarize. Required for `Sum`, `Average`, `Median`, `Min`, `Max`, `Range`, and used by `Show original` to surface a specific value rather than the related record itself.
* **Filter** — which related records to include (e.g. only issues created in the last 30 days, only opportunities in stage "Closed Won").
* **Calculate** — how to combine the matching records.
* **Sort by** + **Limit** *(optional)* — for `Show original`, scope the result to the *N* most recent (or oldest) matching records.

The available calculations are:

| Calculate         | What it returns                                                                                                                                                                                                             |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Count**         | Number of matching records.                                                                                                                                                                                                 |
| **Sum**           | Sum of a numeric field across matching records.                                                                                                                                                                             |
| **Average**       | Average of a numeric field.                                                                                                                                                                                                 |
| **Median**        | Median of a numeric field.                                                                                                                                                                                                  |
| **Min** / **Max** | Smallest / largest value of a number or date field.                                                                                                                                                                         |
| **Range**         | Max − min of a number or date field (returns a duration when applied to dates).                                                                                                                                             |
| **Show original** | The list of matching records, or the list of their field values if a field is selected. Useful for chip-style displays of related records. Combine with sort + limit (e.g. limit 1) to surface a single most-recent record. |

{% hint style="info" %}
**Show original with limit 1** is a single-value rollup, not a one-element list. The result is stored and rendered as a scalar — typed by the underlying field — so it can be used downstream in Formulas, sort, and filters the same way any other typed field would be. Pick this when you want "the most recent X" rather than "a list of one X".
{% endhint %}

#### Example: Number of Open Issues

A count of issues on the account that are still unresolved, filtered to `status != closed`.

<figure><img src="/files/n1DUIwjzPI0OUdV94aHi" alt="" width="375"><figcaption></figcaption></figure>

#### Example: Total ARR Across Opportunities

Sum the `Amount` field across all opportunities in stage "Closed Won" to get total booked ARR for the account.

<figure><img src="/files/fHpRUdznnqwS5VKIuHOU" alt="" width="375"><figcaption></figcaption></figure>

#### Example: Latest Open Opportunity

A `Show original` rollup over opportunities filtered to open stages, sorted by `Created at` descending, limit 1 — surfaces the most recent active opportunity inline on the account.

<figure><img src="/files/iP6ujLrcisc4rJypoNuT" alt="" width="375"><figcaption></figcaption></figure>

#### Example: Latest Issue Resolution Date

The most recent date any issue on the account was resolved.

<figure><img src="/files/zTDrHtoYEQXBwbAnegZc" alt="" width="375"><figcaption></figcaption></figure>

#### Example: Time Span of Opportunities

How spread out opportunity creation is across the account, returned as a duration.

<figure><img src="/files/4sxPYfHkx44HGVanSga5" alt="" width="375"><figcaption></figcaption></figure>

#### Example: Most Recent Contact's Email

The email of the most recently added contact on the account.

<figure><img src="/files/eteUiN2mJ74VsiNzKxzj" alt="" width="375"><figcaption></figcaption></figure>

Other examples of rollups:

* Count of open tasks on the account
* Sum of seats across child contracts (custom object) to get total contracted seats
* List of the 5 most recent opportunities (`Show original`, sorted by `Created at` descending, limit 5)
* Earliest task due date across open tasks (`Min` on `Due date`, filtered to open status)
* The most recent task's title (`Show original` with `Title` field, sorted by `Created at` descending, limit 1)

#### Filters and sorting

Filters and sort behave the same way they do on standard views — any filter you can apply to issues, opportunities, etc. is available as a rollup filter. Sort + limit lets you scope `Show original` rollups to the *N* most recent (or oldest) matching records.

#### Permissions

Rollups respect the viewer's access to the parent record. Related records the viewer cannot read are excluded from `Show original` outputs and from the rendered links, so rollups never expose data the user wouldn't otherwise see.


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.usepylon.com/pylon-docs/account-intelligence/fields/rollups.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
