You'd need to do this by building a custom stat and column that uses the Group By option. See
this guide for the basics on custom statistics creation and
this guide for a deeper walkthrough. The latter was written for PT3 but the techniques all apply to PT4, the interface is just slightly different. For an example stat that uses the grouping mechanism you'd need to employ look at the Preflop Stack Size stat and its column val_p_stack_size.