Aggregations: fixed value count so it can be used in terms order

Closes #7050