Skip to content

Basic Crosstab ​

The fundamental TPL pattern: row dimensions crossed with column dimensions to create a summary table.

Interactive Example ​

Try It
TABLE ROWS occupation COLS education * 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 - Column dimension: education levels become column headers
  • income.sum - Measure: sum of income values populates each cell

The crosstab creates a matrix where each cell shows the sum of income for that specific combination of occupation and education level.

Powered by Malloy and DuckDB