I am trying to filter data using flux for the last 7 days full days (00:00:00 to 23:59:59). I then use aggretateWindow to sum by day. The problem is that all time references are relative to now(). this means the data for the period 7 days ago changes depending on time of the day. Is there an option for the range to be absolute and not relative?
Always check doc first range() function | Flux 0.x Documentation You will find there that you can use a relative duration, absolute time, or integer (Unix timestamp in seconds) for start/stop range parameters. So answer is yes.
I have been through the documentation but now of the options on the range function pick up whole days of data relative to the today.
I have been trying to work out how to strip the time off the start value so it is just 00:00:00 but no joy so far.
I do something similar (comparing last week’s data with this week’s data, where it resets on Sunday morning, I believe), but it sounds like you want the panel to change once per day and reflect the last 7 days worth of data, correct?
but the time reference is relative to now. As you can see in the bar chart there is no battery charging recorded in the first time period. this is because charging was finished at this time (time now 7:20pm).
I understand the time shift function in Grafana with the -7d/d representing whole days 7 days ago. What I can’t work out is how to do it in flux. This creates an error in the syntax
|> range(start: -7d/d, stop:-1d/d)
|> range(start: -7d, stop:-1d) work but backwards from now()