Add group by function to dataset