Skip to content

Column Limits ​

Limits work on column dimensions too. Use [-N] to show the last N values alphabetically, limiting the columns displayed.

Interactive Example ​

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

Query Breakdown ​

  • TABLE - Declares a crosstab table statement
  • ROWS occupation * gender - Two-level row hierarchy: occupation containing gender
  • COLS education[-2] * income.sum - Column dimension with limit applied
    • education[-2] - Last 2 education levels alphabetically (descending)
    • [-2] - Negative number means reverse alphabetical order, limit to 2
  • income.sum - Measure: sum of income for each cell

Column limits use the same syntax as row limits. The [-N] syntax limits to the last N values alphabetically, while [N] would give the first N.

Powered by Malloy and DuckDB