Order All by Value ​
Use DESC@aggregate to order all rows by a computed value instead of alphabetically. This shows all occupations ordered by income from highest to lowest.
Interactive Example ​
Try It
TABLE ROWS occupation DESC@income.sum COLS education * income.sum ;
Dataset:
samplesoccupation, education, gender, incomeTry Variations
Query Breakdown ​
TABLE- Declares a crosstab table statementROWS occupation DESC@income.sum- All occupations ordered by income sum (descending)DESC- Descending order (highest values first)@income.sum- Order by this aggregate value, not alphabetically- No bracket limit - shows all values, just reordered
COLS education * income.sum- Column dimension with education breakdownincome.sum- Measure: sum of income for each cell
Without @, dimensions are ordered alphabetically. With DESC@aggregate or ASC@aggregate, they're ordered by that computed value. Use [-N@aggregate] to combine ordering with a limit.
Related Examples ​
- Order Ascending by Value - Order from lowest to highest
- Top N by Value - Limit results while ordering by value
- Order by Different Aggregate - Sort by one measure, display another