Skip to content

pivot

pivot turns tidy/long data into a wide summary table. Index columns stay as row identity; distinct values from one column become output columns.

It is useful for crosstabs and compact comparison tables. It is also one of the easiest nodes to make unreadable if the pivot column has too many distinct values.

FieldRequiredNotes
inputsyesExactly one upstream table.
indexyesColumns that remain as row identity in the wide result.
columnsyesCategorical column whose distinct values become output columns.
valuesyesNumeric value column to aggregate into each pivot cell.
aggnosum by default; also supports mean and count.
  • values supplies the numeric value for each cell.
  • agg decides how multiple rows in the same bucket collapse. The default is sum; use mean or count when that is the actual question.
  • Empty buckets become null for sum and mean; count returns counts.

default is the pivoted wide table. Inspect total width and the generated column names before sending it to reports or scripts.

- id: monthly
kind: pivot
inputs: [sales]
index: [region]
columns: month
values: revenue
agg: sum # sum | mean | count, default sum
  • aggregate - grouped summaries without widening