Multiple aggregates in single query

Is there a way to have two different aggregates in a group by. Basically what I am looking to do is take the mean across a group by time statement and then sum up across the other tags. For an example.

Lets say I have a metric http.requests.count that has a tag of host. I want to take the mean across the group by time() statement and then sum up the count for the hosts per time interval as well.

Basically something like

select sum("time_avg") from (select mean(count) as "time_avg" where time > now() - 12h group by time(1m), host) group by time(1m)

I realize that I can prob do it with a CQ, but was hoping there was a more adhoc way

Anyone have any ideas on how to achieve this. Based on a few of the links I found it doesn’t seem possible yet

https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/influxdb/uXdYy9JA6_E/cZRzQo7FBAAJ

This seems to be a pretty limiting factor in the influx query language. Both graphite and opentsdb support two aggregations in one query

Which version of the server are you using? Subqueries were added in 1.2 and your query should be possible with that version if I’m understanding it correctly.

@connr Looks like that query is correct and does the described. Are you not getting the desired output.

Yeah I get an error when I try to run the query as shown above

select sum("time_avg") from (select mean(count) as "time_avg" from "http.requests.count" where time > now() - 12h group by time(1m), host) group by time(1m)
ERR: error parsing query: aggregate functions with GROUP BY time require a WHERE time clause

@connr Try adding the same WHERE time > now() - 12h to the outer query. If that doesn’t work then could you please open an issue on InfluxDB?