Skip to content

PivotValueField

Defines a value field in the pivot table — which data field to aggregate and how to compute the aggregation.

Multiple PivotValueField entries on the same field with different aggFunc values create separate columns (e.g. “Revenue (Sum)” and “Revenue (Avg)”).

PropertyTypeDescription
fieldstringThe row data field to aggregate (must exist on the source row objects).
aggFuncAggFuncAggregation function — a built-in name or a custom function.
header?stringCustom column header label. Defaults to "field (aggFunc)" if omitted.
format?(value: number) => stringFormat function for display values. Receives the aggregated number and returns a string. When omitted, the original column’s format is used if available, otherwise raw String(value).
{ field: 'revenue', aggFunc: 'sum', format: (v) => `$${v.toLocaleString()}` }

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