Skip to content

Concatenation with Totals ​

Multiple sections each with their own totals using nested concatenation.

Interactive Example ​

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

Query Breakdown ​

  • ((occupation | ALL) | (education | ALL)) - Two independent sections, each with its own total
  • occupation | ALL - First section: occupation breakdown with total
  • education | ALL - Second section: education breakdown with total
  • * gender - Both sections are crossed with gender as a second level
  • income.sum - Measure: sum of income for each cell

The outer concatenation | creates two separate table sections stacked vertically. Each section has its own dimension and its own total row, allowing you to compare different breakdowns in a single table.

Powered by Malloy and DuckDB