Flux - group by date

The suggestions i find online to group by date is:

|> aggregateWindow(every: 1d, fn: sum, createEmpty: false)

However, this seems to have some unexpected behavior. I’d expect it to group by each day, but it appears to be driven by something slightly different. Do i perhaps need to specify a timezone or some other criteria to get it to group by the date in the timestamps and not evaluate the time portion whatsoever?

It even went so far as to have two entries for the same day. This 2nd entry contains everything after 8PM… and the 2nd entry will switch to be 7/10 once we cross over midnight.

Welcome @btarb24 to the forum.

I see you are using Grafana. Just a few things come to mind…

What happens if you change the aggregateWindow statement to this:

|> aggregateWindow(every: 1d, fn: sum, createEmpty: false, timeSrc: "_start")

See this thread for more ideas.

Thank you for the reply. It was still off, but i was able to get the desired result by adding this to top of my query to apply the correct time zone. My data was stored as UTC and this applied it to my current tz.

import “timezone”
option location = timezone.location(name: “America/New_York”)