Are Conditional Aggregations Possible?

I want to run a count query with an associated aggregation, but only run the aggregation if the count for the query is below a certain number.

Is this possible?