Aggregation by locations with where clause