Skip to content

Row Percentages ​

ACROSS COLS makes each row sum to 100% across its columns.

Interactive Example ​

Try It
TABLE
  WHERE occupation IS NOT NULL
  ROWS occupation * gender
  COLS education * (income.sum ACROSS COLS)
;
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 COLS) - Calculates percentage within each row; values sum to 100% horizontally

ACROSS COLS computes percentages by dividing each cell by its row total. This shows how income is distributed across education levels for each occupation-gender combination.

Powered by Malloy and DuckDB