Skip to content

Aggregate

The Aggregate node turns a list of records into figures: how many there are, what they add up to, the average amount, the largest, the oldest… Without grouping it returns a single object; if you set a grouping field it returns one row per group (sales per product, leads per status, tickets per owner) and you can sort them and keep the first ones.

It understands numbers written with a decimal comma ("20,5"). Anything that is not a number is ignored in sums, averages, minimums and maximums; if a column has no numbers at all (for example YYYY-MM-DD dates), minimum and maximum compare the texts.

ParameterTypeRequiredDescription
pathtextNoPath to the list (orders, data.items…). Empty = the incoming data (or items / data if they are a list)
metricstextareaYesMetrics name=operation:field, one per line or comma-separated
groupBytextNoField to group by (paths such as customer.country work)
sortBytextNoWith groups: name of a metric or of the grouping field; with a leading -, descending
limitnumberNoWith groups: maximum rows (top N). Empty or 0 = all
decimalsnumberNoRounding of sums and averages, 0 to 10 (default 2)
outputKeytextNoOutput field (default resumen)
OperationResult
countNumber of items. With a field (count:email), only those where it is filled in
sum:fieldSum of the numeric values
avg:fieldAverage of the numeric values (null if there are none)
min:field / max:fieldMinimum / maximum (numbers or, if there are no numbers, texts such as ISO dates)
first:field / last:fieldFirst / last filled-in value
distinct:fieldHow many distinct values there are
join:fieldThe values joined with commas (handy for a text summary)

Without grouping, with metrics = "orders=count, total=sum:amount":

{
"resumen": { "orders": 5, "total": 35.75 },
"count": 5
}

Grouping by product, with sortBy = "-total":

{
"resumen": [
{ "product": "B", "orders": 1, "total": 20.25 },
{ "product": "A", "orders": 3, "total": 15.5 }
],
"count": 5
}

The node keeps the incoming data and adds the result and count (items in the list). If what arrives is directly a list (for example, the output of an Array Filter), the list is kept in items, so you can use it afterwards with List to Text (source: items). Records with no value in the grouping field form one group with an empty value.

{
"label": "Top products",
"path": "orders",
"metrics": "sales=sum:total, orders=count",
"groupBy": "product",
"sortBy": "-sales",
"limit": 5,
"outputKey": "top"
}

Combine it with the List to Text node (source: top) to build the report message.

{
"label": "Weekly summary",
"path": "sales",
"metrics": "total=sum:amount, average_ticket=avg:amount, largest=max:amount, customers=distinct:customer_id, first=min:date"
}
  • arrayFilter (Array Filter - to keep the records you care about before summarizing)
  • arrayGroupBy (Array Group By - groups without computing metrics)
  • listToText (List to Text - to turn the result into text or a table)