Skip to content

Column Percentages ​

ACROSS ROWS makes each column sum to 100% down its rows.

Interactive Example ​

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

Query Breakdown ​

  • ROWS occupation * gender - Creates row hierarchy with occupation and gender
  • COLS education - Education levels as columns
  • (income.sum ACROSS ROWS) - Calculates percentage within each column; values sum to 100% vertically

ACROSS ROWS computes percentages by dividing each cell by its column total. This shows how income is distributed across occupations and genders within each education level.

Powered by Malloy and DuckDB