Adding aggregate function for Roxie query