I am having an issue with flux when it comes to getting the right values based on time. I have 2 queries as you see below. One that queries the data for 1 day and the other that query the data for 1 week.
On the value for grid for 1 day (6/03), I get 9,1760.19 kWh
On the value for grid for 1 week, I get 10,351.29 kWh for the same day (6/03)
I suspect it has to do with 1 hour shift but I cannot figure out how to fix it and which one is accurate.
So I checked the data and the difference between the 2 is that in the case of the daily query, the aggregatewindow starts at 01am where for the weekly one, it will shows on the table list a value data for 6/4 at 12:00:00 PDT.
I believe the weekly one to be wrong because I have another aggregation before of 1 hour so the 12:00:00 PDT would be from 11pm to 12am and that should be counted in the previous day.
You can try putting an offset into the aggregateWindow function. Several examples that I created here.
Example: |> aggregateWindow(every: 1w, offset: -3d, fn: sum) // sums the 7 days of each week to get the total used per week, and use -3d as the offset to move the weekly aggregate to start on a Monday