Hi all. I’m new to Influx and I wanted to get a second set of eyes on this query. I’m collecting data every 10s from my solar panels. I want to sum up the amount collected every day (midnight->23:59:59) from both sets of panels (ppv1 & ppv2), and then show that over the last 30 days.
I’m doing this in Grafana if that matters, and so I set the ‘min interval’ to 1d, and ‘relative time’ to ‘now-30d’. This is a bar chart, 1 “bar” per day summed of all data points for both panels.
from(bucket: "solar")
|> range(start: v.timeRangeStart, stop:v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "inverter")
|> filter(fn: (r) => r._field == "ppv1" or r._field == "ppv2")
|> group(columns: ["_time"])
|> sum(column: "_value")
|> group()
|> aggregateWindow(every: v.windowPeriod, fn: sum, createEmpty: false)