Hello InfluxDB users,
I am using InfluxDB to log data from a RabbitMQ stream, which works great! I just have one question about how to write a specific query and if that is even possible.
The data gathered is continuous data about power usage and solar power generated for a whole site of 16 buildings. The buildings are tagged in the time series, so if I want to get the solar production history for the last day for building X, that would look something like this;
SELECT mean(solar) FROM amqp_consumer WHERE id = 'X' AND time > now() - 1d GROUP BY time(1m)
this works as expected.
However, I would also like to know the solar production for the whole site and this is where I run into problems. Querying the mean for all values does not work, as it obviously averages all the buildings. Querying the sum of all values also does not work, as it gives me a total across time. What I would need is to get the mean per building (as in the query above) and add those together. Something like;
SELECT sum_by_time_slice(mean(solar)) FROM amqp_consumer WHERE time > now() - 1d GROUP BY id, time(1m)
I am currently doing this in the client and that works. I would like to do it directly from InfluxDB, though.
Is this possible?