Skip to content

AggFunc

Built-in aggregation functions for pivot value fields.

Each function is applied per-cell to aggregate the matching data rows into a single value:

FunctionResultBlank handling
'sum'Numeric total of all valuesNon-numeric values ignored
'avg'Arithmetic meanNon-numeric values excluded from count
'count'Number of rows in the groupCounts all rows including blanks
'min'Smallest numeric valueNon-numeric values ignored
'max'Largest numeric valueNon-numeric values ignored
'first'Value from the first row in the groupMay be undefined if group is empty
'last'Value from the last row in the groupMay be undefined if group is empty
type AggFunc = "sum" | "avg" | "count" | "min" | "max" | "first" | "last"
const valueFields: PivotValueField[] = [
{ field: 'revenue', aggFunc: 'sum', header: 'Total Revenue' },
{ field: 'revenue', aggFunc: 'avg', header: 'Avg Revenue' },
{ field: 'orders', aggFunc: 'count', header: '# Orders' },
];
AI assistants: For complete API documentation, implementation guides, and code examples for this library, see https://raw.githubusercontent.com/OysteinAmundsen/toolbox/main/llms-full.txt