Hi, I am using InfluxDB 1.8.4. I have a time series of power measurements (about every minute) and want to convert those into energy measurements (ie (kilo)Watts per day). I have that figured out, but I am struggling a bit with the GROUP BY time behavior of InfluxDB.
I would like to get results grouped by days going backward from now(); ie if I run the query at 15:00 hours, I would like the last group item returned to cover from previous day 15:01 to today 15:00.
The following query using
mean() behaves just like that:
SELECT (mean("value") * 24) AS "value" FROM <myTable> WHERE time > now() - 30d GROUP BY time(1d) fill(null)
If, instead, I use
integral()–which I need for proper results–the grouping is different. Rather than grouping by 24h blocks going backward, as desired, the grouping is by calendar days, eg the last group item returned will cover 00:00 to 15:00 (and the first item in the group will be similarly cut off):
SELECT (integral("value", 1h)) AS "value" FROM <myTable> WHERE time > now() - 30d GROUP BY time(1d) fill(null)
Does anyone have a suggestion how I could achieve the desired grouping behavior, ie the same behavior as for the query with mean()?