Hi Deepa,
You are getting error because your query is now having new schema, it has no value present of previous activities.
You can perform your operation by two ways:
1) Take two query condition, one where you will do aggregation and second where you will query on your schema. Then perform union/intersection based on your requirement.
2) First perform aggregate and then use enrichment to enrich with your schema.
Thanks.