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:
| Function | Result | Blank handling |
|---|---|---|
'sum' | Numeric total of all values | Non-numeric values ignored |
'avg' | Arithmetic mean | Non-numeric values excluded from count |
'count' | Number of rows in the group | Counts all rows including blanks |
'min' | Smallest numeric value | Non-numeric values ignored |
'max' | Largest numeric value | Non-numeric values ignored |
'first' | Value from the first row in the group | May be undefined if group is empty |
'last' | Value from the last row in the group | May be undefined if group is empty |
type AggFunc = "sum" | "avg" | "count" | "min" | "max" | "first" | "last"Example
Section titled “Example”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