Hi all,
I am using Grafana 10.2.2 with Influxdb v2.7.8 to monitor my energy consumption and display monthly usage. I can say it is working, but only one problem: the monthly cutoff date is always on 30th even though the raw data provides until 31st. Here is one example.
Cutoff date for month December ends at 30th of December, similar thing happened to month of October.
Here is the code I put inside Grafana
option location = {zone: "", offset: 1s}
from(bucket: "gupbdg-powermon")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["entity_id"] == "monthly_total_energy")
|> filter(fn: (r) => r["domain"] == "sensor")
|> filter(fn: (r) => r["_field"] == "value")
|> filter(fn: (r) => r["_measurement"] == "kWh")
|> aggregateWindow(every: 1mo, fn: last, createEmpty: false)
|> yield(name: "last")
Here is the screenshot of the raw data.
I am expecting that, a monthly aggregateWindow function provides end of month cutoff date according the the number of days each month, be it 30, 31 or 28 in February. But why my configuration always cuts off at 30th every month?
Any help to sort this problem is very much appreciated. Thank you in advance.
2 posts - 2 participants