calculate aggregates based on counts (story #2468)