The values shown seem correct for me, but I would expect the date to be 30th of September, because I expect to have the last value of that day. So I would want the break point to be 23:59:59 on 30th of September rather than 00:00:00 on 1st of October. Is that somehow possible?
@Matthias182 By default, aggregateWindow() has a timeSrc parameter that defines the column to pull the new time for the aggregated point from. By default, this is _stop (the stop time of each window). To get it to behave the way you want, set timeSrc to _start:
// ...
|> aggregateWindow(every: 1d, fn: last, timeSrc: "_start")
@scott Thanks a lot for your reply. I tried this and now I think by problem is even more complex. Data written in InfluxDB is (correctly) in UTC. So in UTC time the day break is for me at 22:00:00. This is also what the data shows as the value is reset to 0 in this example:
And I would like the aggregation to work based on UTC time but show local time. So in this specific example I would want 3 as last value for the 5th of October.
@scott The timeshift is already known to me, but since we have the daylight saving here, the difference is not fixed but changes based on the timezones. I would need something similar that works based on the timezone rather than a fixed offset. Is there something available?
@Matthias182 You need to import the timezone package and use it to set the location option. This will change the behavior of aggregateWindow to account for time changes.
Note: the timezone package will not adjust timestamps to the specific timezone. It just makes it so windowing data by time can account for time changes.