Aggregate
Groups items and performs aggregation operations like SUM, AVG, COUNT, and more.
Overview
The Aggregate node collects all input items and produces summary results. Use it to:
- Calculate totals and averages
- Group data by categories
- Find minimum and maximum values
- Count items or distinct values
- Collect values into arrays or objects
Parameters
| Parameter | Description | Required |
|---|---|---|
| Group By | Fields to group items by | No |
| Aggregations | List of aggregation operations | No |
| Include Group Fields | Add group keys to output | No |
| Fuzzy Compare | Case-insensitive, trimmed grouping | No |
Group By
When specified, items are grouped by the values of these fields. Each unique combination produces one output item.
Leave empty to aggregate all items into a single result.
Aggregations
Each aggregation specifies:
| Property | Description |
|---|---|
| Input Field | The field to aggregate (or * for whole item) |
| Operation | The aggregation function |
| Output Field | Name for the result |
| Options | Operation-specific settings |
Aggregation Operations
| Operation | Description | Options |
|---|---|---|
| SUM | Total of numeric values | - |
| AVG | Average of numeric values | - |
| MIN | Minimum value | - |
| MAX | Maximum value | - |
| COUNT | Number of items | - |
| COUNT_DISTINCT | Number of unique values | - |
| JOIN | Concatenate string values | delimiter (default: ", ") |
| COLLECT_ARRAY | Gather values into array | distinct, flatten |
| COLLECT_OBJECT | Build object from key-value pairs | keyField |
| FIRST | First value in group | - |
| LAST | Last value in group | - |
Default Behavior
If no aggregations are specified, the node collects all items into a single array using COLLECT_ARRAY.
Output
One item per group (or one item if no grouping):
Input items:
[
{ "category": "A", "amount": 100 },
{ "category": "A", "amount": 200 },
{ "category": "B", "amount": 150 }
]
Group By: category
Aggregation: SUM of amount as total
Output:
[
{ "category": "A", "total": 300 },
{ "category": "B", "total": 150 }
]
Examples
Total All Items
Sum all amounts without grouping:
- Leave Group By empty
- Add Aggregation:
- Input Field:
amount - Operation:
SUM - Output Field:
grandTotal
- Input Field:
Output: { "grandTotal": 450 }
Group by Category
Calculate totals per category:
- Group By:
category - Enable Include Group Fields
- Add Aggregations:
- SUM of
amountastotal - COUNT as
count
- SUM of
Collect Unique Values
Get all unique tags:
- Add Aggregation:
- Input Field:
tag - Operation:
COLLECT_ARRAY - Output Field:
allTags - Options:
distinct: true
- Input Field:
Join Names
Create comma-separated list:
- Add Aggregation:
- Input Field:
name - Operation:
JOIN - Output Field:
nameList - Options:
delimiter: ", "
- Input Field:
Multiple Aggregations
Calculate statistics per region:
- Group By:
region - Add Aggregations:
- SUM of
salesastotalSales - AVG of
salesasavgSales - MIN of
salesasminSale - MAX of
salesasmaxSale - COUNT as
orderCount
- SUM of
Build Lookup Object
Create a mapping from items:
- Add Aggregation:
- Input Field:
* - Operation:
COLLECT_OBJECT - Output Field:
lookup - Options:
keyField: "id"
- Input Field:
Output: { "lookup": { "1": {...item1...}, "2": {...item2...} } }
Tips
- Aggregate runs once for all items (single execution mode)
- Use "Fuzzy Compare" for case-insensitive grouping
- COUNT doesn't need an input field
- Empty groups are not included in output
- Null values are typically excluded from calculations
- Use COLLECT_ARRAY with
flatten: true(default) to flatten nested arrays