Grouping example that sorts groups by aggregated column