how to calculate aggregate - Search