Skip to content

Nested Subtotals ​

Place ALL at inner nesting levels to create subtotals within each parent group.

Interactive Example ​

Try It
TABLE
  ROWS occupation * (gender | ALL)
  COLS (education | ALL) * income.sum
;
Dataset:samplesoccupation, education, gender, income
Try Variations

Query Breakdown ​

  • occupation * (gender | ALL) - For each occupation, shows male, female, and a subtotal
  • (education | ALL) - Each education level plus a column total
  • * income.sum - The aggregation applied to all cells

When ALL appears inside a nesting (after *), it creates subtotals per parent group rather than a single grand total. Each occupation gets its own gender subtotal row.

Powered by Malloy and DuckDB