Calculate percentage of metric to its totalValue groupBy query


I’ve a use case where groupBy query is done to return a metric called as ‘volume’. Now we want to calculate the percentage = Volume /TotalVolume. TotalVolume here is the total of all the volumes without groupBy in consideration/much like timeSeriesQuery.

Example: Here volume is the metric and percentage is calculated as postAggregator

TotalVolume = 140+320+350 = 810


volume: 140

volumePercentage: 140/810



volume: 320

volumePercentage: 320/810

}, event:{

volume: 350

volumePercentage: 350/810


I cant find a way to do it in single groupBy query. So I first did a timeseries query to get the totalVolume and then pass the totalVolume to a postAggregator in groupByQuery.

Is there any simple way to do the same?