Skip to content

Aggregate

Type key: aggregate
Group: Data
Category: data
Tier: CORE

The Aggregate node groups an array of records and computes aggregate statistics (SUM, AVG, COUNT, MIN, MAX) per group or across the entire dataset. It is the workflow equivalent of a SQL GROUP BY with aggregate functions.

Handles

HandleDirectionDescription
inputInputReceives data containing the array to aggregate
outputOutputEmits { "data": [ ...aggregated records ] }

Configuration

FieldTypeDefaultDescription
array_pathstring""Dot-notation path to the array in the input (e.g. data, body.orders)
group_bystring""Field to group records by (empty = aggregate entire dataset)
aggregationsarray[]Array of aggregation definition objects

Aggregation Object

json
{
    "alias": "total_revenue",
    "operation": "sum",
    "field": "total"
}
PropertyDescription
aliasName of the computed field in the output
operationAggregation function: sum, avg, count, min, max, first, last
fieldThe field from each record to aggregate

Aggregation Functions

FunctionDescription
sumSum of all numeric values
avgAverage of all numeric values
countCount of records in the group
minMinimum numeric value
maxMaximum numeric value
firstValue from the first record in the group
lastValue from the last record in the group

Behavior

Without group_by

All records are aggregated into a single result object:

Input:

json
{
    "data": [
        { "category": "A", "total": 100 },
        { "category": "B", "total": 200 },
        { "category": "A", "total": 150 }
    ]
}

Config: sum total → total_revenue, count → record_count

Output:

json
{
    "data": [{ "total_revenue": 450, "record_count": 3 }]
}

With group_by

Records are grouped by the specified field, and aggregations are computed per group:

Config: group_by: category, sum total → total_revenue, count → count

Output:

json
{
    "data": [
        { "category": "A", "total_revenue": 250, "_count": 2, "count": 2 },
        { "category": "B", "total_revenue": 200, "_count": 1, "count": 1 }
    ]
}

The group_by field is automatically included in each output record. A _count field is always added to every group, regardless of whether a count aggregation is defined explicitly.

Array Path

If the input data is nested, specify the path to the array:

yaml
Input: { "response": { "orders": [...] } }
Array Path: response.orders

If array_path is empty, the node looks for arrays at data, then output, then the root.

Example: Daily Sales Report

Aggregate node — sales report exampleAggregate node — sales report example
yaml
Array Path: data
Group By: status
Aggregations:
  - alias: total_revenue,  operation: sum,   field: total
  - alias: order_count,    operation: count, field: id
  - alias: avg_order,      operation: avg,   field: total
  - alias: max_order,      operation: max,   field: total

Output:

json
{
    "data": [
        {
            "status": "completed",
            "total_revenue": 15000,
            "order_count": 42,
            "avg_order": 357.14,
            "max_order": 2000
        },
        {
            "status": "refunded",
            "total_revenue": 500,
            "order_count": 3,
            "avg_order": 166.67,
            "max_order": 300
        }
    ]
}

💾 Try this example

Download the workflow JSON — open an empty workflow and import the file.

Notes

  • The Aggregate node processes the data entirely in PHP memory using Laravel Collections — very large datasets may require chunked processing
  • Records with a null value in the field are excluded from numeric aggregations (sum, avg, min, max) but still counted in count
  • Multiple aggregations can be defined in a single node — all are computed in a single pass

Proprietary software — source-available. All rights reserved.