Hi! I have water meter data, but the data is being logged only during “business hours”, so it starts around 4am, stops around 5pm and is not logged on weekend.
I’d like to have a graph with daily water consumption. For now, I have something like
If the equipment is shut down every night from 17:01 to 03:59 the next day, one can use the Flux function hourSelection() which filters rows by time values in a specified hour range.
|> hourSelection(start: 4, stop: 17)
So your first range() function does not need to have all that extra stuff. Just picking a start & stop will work and the hours of the day will be filtered based on the hourSelection function.
Re: the days of the week to include/exclude, not sure if that functionality exists in Flux. My guess is that it does, but will try to look around, or maybe someone else will chime in.
Sorry for the delay. I am not completely sure this is what you are seeking, but I think this should give you the daily consumption. If you set the time selector for the past 1 or 3 or 7 days, you should see a total value for each day.
The above does not care whether the water flow started at 12:01 AM or 4:15 AM or 7 AM, nor what time it stopped. It’s just summing up the values being reported during each day.
In order to distribute the weekend’s data evenly across Friday, Saturday and Sunday, I think you would have to create some sort of custom function to extract those 3 days of the week (which Flux can do) and then do the math there, but that is beyond my knowledge level.