Add z.rate to group by