// make.com integration

Group & Aggregate Array

The Group & Aggregate Array module groups an array by a field and calculates sums, averages, counts and more in one step. It replaces the classic Iterator + Aggregator chain in Make.com with a single module and a single operation.

How it works

You pass in an array, choose a field to group by, and define one or more aggregations. The module returns one collection per group, each containing the group key, the item count, and one result field per aggregation.

Because everything happens inside one module call, the whole aggregation costs one operation, no matter how many items the array contains. The equivalent Iterator + Aggregator pattern costs one operation per item, so a 500 item array would burn 500+ operations. This module always costs 1.

Module Fields

FieldDescriptionHow to use it
ConnectionLinks the module to the CustomJS serviceSelect or create a connection using your API key
Items (Array)The array to aggregateMap an array from a previous module directly, or paste a JSON string. Both work
Group By FieldThe field to group items byUse dot notation for nested fields, e.g. customer.name. Leave empty to put everything into a single group
AggregationsA repeatable list of calculations to run per groupFor each entry, pick an Operation (Sum, Average, Min, Max, Count non-empty, Count distinct, First, Last, Collect values, Join as text), a Field as a dot path (e.g. order.total), and optionally an Output Key to name the result field. Without an Output Key the result is named operation_field, like sum_total
Deduplicate ByRemoves duplicate items before aggregatingProvide a field path. Items with the same value at this path are reduced to one before any grouping happens
Include items per groupAdds the raw items of each group to the outputBoolean, default off. Turn it on if a later module needs the original items of each group
Sort groups byOrders the resulting groupsEnter a result field name such as key, count or sum_total, then pick a Sort direction (Ascending or Descending)

Usage example

Say a previous module returns a list of orders and you want revenue per customer:

Input (Items):

[
  { "customer": { "name": "Acme Corp" }, "total": 120.50, "status": "paid" },
  { "customer": { "name": "Acme Corp" }, "total": 79.90,  "status": "open" },
  { "customer": { "name": "Globex" },    "total": 300.00, "status": "paid" }
]

Settings:

  • Group By Field: customer.name
  • Aggregation 1: Operation Sum, Field total, Output Key sum_total
  • Aggregation 2: Operation Count distinct, Field status, Output Key status_count

Output (Groups):

[
  { "key": "Acme Corp", "count": 2, "sum_total": 200.4, "status_count": 2 },
  { "key": "Globex",    "count": 1, "sum_total": 300,   "status_count": 1 }
]

Output

OutputDescription
GroupsAn array of collections, one per group. Each contains key, count, plus one field per aggregation
Group CountHow many groups were created
Total ItemsHow many items were processed after deduplication
Removed DuplicatesHow many items were removed by Deduplicate By

Good to know

  • Localized numbers work. Numeric fields tolerate localized strings such as "19,90", so European decimal commas do not break your sums.
  • Averages are rounded to 6 decimal places.
  • One operation, always. One module call costs one operation regardless of array size. An Iterator + Aggregator chain costs one operation per item, which adds up fast on large arrays.
  • Empty Group By Field produces exactly one group covering all items, which is handy for grand totals.

See the Make.com integration overview for setup instructions, and check out the other utility modules: AI JSON Parser, Parse Localized Number, Format Date & Convert Timezone and File to Base64. For a full walkthrough with real scenarios, read How to group and sum arrays in Make.