> ## Documentation Index
> Fetch the complete documentation index at: https://help.teable.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Conditional Rollup: count and summarize matches

> Filter records in another table and calculate a count, sum or average without a Link field. Use conditions for task totals, sales reporting or duplicate checks.

Conditional Rollup filters matching records from a target table without creating a link relationship first, then calculates statistics on a selected field. It is useful for calculating counts, sums, averages, and other results based on field values in the current record.

## Use Cases

| Scenario | Good for |
| - | - |
| Employee task statistics | Count in-progress tasks and completed tasks for an assignee |
| Period sales statistics | Calculate sales amount, order count, or average order value by date range |
| Duplicate data checks | Count duplicate names, phone numbers, or IDs |
| Regional reports | Aggregate business data by region, store, or channel |

## Procedure

**1. Create a conditional rollup field**

Click the `+` icon on the right side of a field name, choose **Conditional Rollup**, and enter a field title, such as "Total sales amount".

**2. Choose the target table**

In the target table dropdown, choose the table to query.

**3. Configure the rollup field**

Choose the field to calculate and confirm the field type.

**4. Set filter conditions**

Add filter conditions, choose the field, condition type, and comparison value. The comparison value can be a static value or a field from the current table.

When matching across tables, you can use **is** to compare a Link field in the target table with a text field or a formula that returns a single text value in the current table. Click **Use field value** and select the field to match against linked record titles.

**5. Choose an aggregate function**

Choose a calculation method based on the data type, such as original value, unique values, unique count, sum, count, average, maximum, or minimum.

## Scenario Practice

### Team Task Volume Statistics

**Tables**

* Tasks table
* Statistics table

A team admin needs to count tasks in different statuses for each employee, such as in-progress and completed tasks, to understand workload distribution and completion progress.

**In-progress tasks**

1. In the employee information table, create a Conditional Rollup field named "In-progress tasks"
2. Target table: Task assignments table
3. Rollup field: Task ID
4. Filter conditions:
   * Field: Assignee -> Condition: Equals -> Value: Employee field from the current table
   * Field: Task status -> Condition: Equals -> Value: "In progress"
5. Aggregate function: Count all

**Completed tasks**

1. Create another Conditional Rollup field named "Completed tasks"
2. Target table: Task assignments table
3. Rollup field: Task ID
4. Filter conditions:
   * Field: Assignee -> Condition: Equals -> Value: Employee field from the current table
   * Field: Task status -> Condition: Equals -> Value: "Completed"
5. Aggregate function: Count all

### Find Duplicate Values

**Tables**

* Customers table, with fields such as customer name and phone number

In the customers table, find duplicate customer names before merging customer profiles.

**Steps**

1. In the customers table, create a Conditional Rollup field named "Customer name duplicate count"
2. Target table: Customers table (this table)
3. Rollup field: Customer name
4. Filter condition:
   * Field: Customer name -> Condition: Equals -> Value: Customer name field from the current table
5. Aggregate function: Count all
6. Create a Formula field named "Duplicate flag"
7. Set the formula to `IF(Customer name duplicate count > 1, "Duplicate", BLANK())`

The customers table shows how many times each customer name appears and marks duplicate records with "Duplicate", so you can filter and handle them later.

## FAQ

> [accordion] What is the difference between Conditional Rollup and Conditional Lookup?
>
> Conditional Rollup returns one calculated value, which works well for totals, counts, and averages. Conditional Lookup returns a list of matching raw values, which works well for viewing detail data.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.