Filtered and unfiltered aggregation in the same query

Hi guys,

Having, for instance, such a case:

Dimension: name
Dimension: gender
Dimension: birthYear
Metric: count

I would like to get in a single query the total “count” by a dimension (let it be “birthYear”) and the “count” by the same dimension but only for a specific “gender”.

What would be the most optimal way to do it?
I’ve succeeded to do it with a javascript aggregator. Do you think the best way would be a custom aggregator or maybe there is some in-house aggregation for this case. At least, i could not find something ready to be used.

Thanks, Vadim.

Please refer “Filtered Aggregator” here
It may be of your interest.