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.
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.
I am using a template sensor in Home Assistant to monitor monthly electricity consumption. The sensor worked properly by providing measurement up until 31 Dec 2024 23.59.59 (similar case on October whereby raw data at Home Assistant Template Sensor cuts off at 31 Oct 2024 23.59.59) and the Influxdb shows the same (meaning, last timestamtp data was at 31 Dec 2024 at 23.59.59). That’s why I dont’t understand why Grafana cuts off at 30th every month, even though actually the month should have cut off at 31.
Just for kicks, can you replace your aggregateWindow line with this one and see how it affects your query results? |> aggregateWindow(every: 1mo, offset: 1d, fn: last, timeSrc:"_start")
You might also see how adding createEmpty: true affects the results.
Hi,
Just applying the update and the result as follow:
Applying createEmpty = true showed up the previous months where the data is not yet available, so this view is not suitable, at least aesthetically.
Applying aggregateWindow(every: 1mo, offset: 1d, fn: last, createEmpty: false) results in the following graph (a small portion of the usage of 1st date is separated, yet the total usage of past month (December) still ends at 30th, 23:59:59).
I changed the query as proposed, aggregateWindow(every: 1mo, offset: 1d, fn: last, createEmpty: false) to all 6 queries, and the resulting graph shows like this (full month of December no longer showing, only shows 01-Dec-24, and 01-Jan-25 is separated from the rest of this mont, still showing up to 31-Jan-25 at 22.18 my local time):