Aggregate Column
Aggregate Column
Section titled “Aggregate Column”Type: aggregate-column · Package: DataTable Activities v1.0.0 · Output: double
Calculates a summary value on a column of a DataTable: the sum, count, average, minimum, or maximum. It is the direct way to obtain totals and metrics from a data set — the total to be collected, the number of records, the average of an indicator.
How it works
Section titled “How it works”Applies the indicated operation to the values of column and returns a number. For numerical operations (sum, avg, min, max), the column must contain numbers; count counts the rows.
Required parameters
Section titled “Required parameters”| Parameter | Editor | Description |
|---|---|---|
table | expression | The DataTable. |
column | text | Name of the column to add. |
operation | list | Operation: sum · count · avg · min · max. |
Optional parameters
Section titled “Optional parameters”Ninguno.
Output
Section titled “Output”Returns a double with the result of the aggregate.
Example
Section titled “Example”Total and average sales:
Aggregate Column table = = ventas column = "Monto" operation = sum → output: totalAggregate Column table = = ventas column = "Monto" operation = avg → output: promedioLog message = = "Total: " + total + " · Promedio: " + round(promedio, 2)Related activities
Section titled “Related activities”- Group By — agregados por grupo en vez de uno global.
- Filter DataTable — narrow rows before adding.