Skip to content

Column Nesting ​

The * operator nests dimensions in columns. Here education contains gender as sub-columns beneath each education level.

Interactive Example ​

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

Query Breakdown ​

  • TABLE - Declares a crosstab table statement
  • ROWS occupation - Row dimension: occupation values become row headers
  • COLS education * gender - Column hierarchy: education is the outer dimension, gender is nested within each education level
  • income.sum - Measure: sum of income values for each cell

The * operator creates a parent-child relationship in columns where each education value spans multiple gender sub-columns beneath it.

Powered by Malloy and DuckDB