Nested Limits ​
Apply limits at multiple nesting levels in a hierarchy. This shows the top 3 occupations by income, then the top 2 education levels within each.
Interactive Example ​
Try It
TABLE ROWS occupation[-3@income.sum] * education[-2@income.sum] COLS gender * income.sum ;
Dataset:
samplesoccupation, education, gender, incomeTry Variations
Query Breakdown ​
TABLE- Declares a crosstab table statementROWS occupation[-3@income.sum] * education[-2@income.sum]- Nested hierarchy with limits at each leveloccupation[-3@income.sum]- Top 3 occupations by income sum[-3]- Negative means descending order, limit to 3@income.sum- Order by this aggregate, not alphabetically
education[-2@income.sum]- Within each occupation, top 2 education levels by income
COLS gender * income.sum- Column dimension with gender breakdownincome.sum- Measure: sum of income for each cell
Each level of the hierarchy can have its own independent limit and ordering. The inner limits are applied within the context of each outer group.
Related Examples ​
- Top N by Value - Single-level value-based limits
- Order by Value - Order without limiting the count
- Column Limits - Apply limits to column dimensions