apply integral after group by for better smoothing