I'm trying to create a function that works on group by statements like functions can currently on non group by statements. The only way can think of currently is to loop over the individual bits. Any other thoughts?