Aggregate Column
Aggregate Column
Section titled “Aggregate Column”Type: aggregate-column · Package: DataTable Activities v1.0.5 · Output: number
Computes a summary value over a DataTable column: the sum, the count, the average, the minimum or the maximum. It is the direct way to get totals and metrics from a data set — the total to collect, the number of records, the average of an indicator.
How it works
Section titled “How it works”Applies the given operation to the values of the column and returns a number.
sum,avg,minandmaxtake every cell that can be converted to a number (with a dot as decimal separator,1500.50). Empty or non-numeric cells are skipped without error and do not count toward the average.countreturns the number of rows in the table, without looking at the column content (empty cells are counted too).- If no cell is numeric (or the table has no rows),
sum,avg,minandmaxreturn0.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
table | DataTable | — | The DataTable. |
column | string | — | Name of the column to aggregate. |
operation | string | — | Operation: sum · count (row count) · avg (average) · min (minimum) · max (maximum). |
Optional parameters
Section titled “Optional parameters”None.
Output
Section titled “Output”Returns a number (double) with the result. count is also returned as a number (12 → 12.0); use toInt(...) if you need an integer.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
'table' must be a DataTable. | table does not evaluate to a DataTable. |
'column' is required. | The column name is missing. |
Column '…' does not belong to table …. | The column does not exist in the table (.NET message). Check the exact name. |
Unsupported operation '…'. Use: sum, count, avg, min, max. | operation is not one of the valid values. |
Example
Section titled “Example”Total and average of sales:
Aggregate Column table = sales column = "Amount" operation = sum → output: totalAggregate Column table = sales column = "Amount" operation = avg → output: averageLog message = "Total: " + total + " · Average: " + round(average, 2)Related activities
Section titled “Related activities”- Group By — aggregates per group instead of a single global one.
- Filter DataTable — narrow down the rows before aggregating.
- Get Column — get all the column values as a list.