aggregates by category based on any field