Aggregate value calculation is done before sorting