Skip to content

Group By

Type: group-by  ·  Package: DataTable Activities v1.0.0  ·  Output: DataTable

Groups rows by values in a column and calculates one or more aggregates per group, returning a summary table. It is the equivalent of a pivot table: “total sales per customer”, “number of orders per state”, “average per region”.

Gather the rows that share the same value into the grouping column and, for each group, calculate the aggregations that you define. The result is a new table with one row per group: the grouping column plus one column for each aggregate.

ParameterEditorDescription
tableexpressionThe DataTable to group.
columntextColumn to group by.
aggregationsarregloList of {column, operation, alias} objects. operation: sum · count · avg · min · max. alias is the name of the resulting column.

Ninguno.

Returns a DataTable with one row per group: the grouping column and one column per aggregate (named after its alias).

Total and number of invoices per client. In the Designer, aggregations are defined with a visual editor: for each one you choose column, operation and an alias (name of the resulting column).

Group By
table = = facturas
column = "Cliente"
aggregations:
Total · sum → alias "TotalCliente"
Total · count → alias "NumFacturas"
→ output: resumenPorCliente

The result has columns Cliente, TotalCliente and NumFacturas, with one row per customer.