Is it possible to exclude specific weekdays from a Flux query?
Example: I am querying the last 4 week but don’t want all data with timestamp on Saturdays and Sundays
I could imagine you can do something similar with date.weekDay() function and some math. Unfortunately I don’t have too much experience with Flux so I couldn’t test it myself
@emil you can filter on the _time column and use date.weekDay() to determine the actual day of the week. To keep this as optimized as possible, I’d suggest you run this time filter after all other filters if possible:
Thanks for the answer @scott . I have tested the query today and it is working fine.
Maybe one more question. I am not sure if this is in scope of this topic but is it possible to specify regex (I want to use this together with the Grafana variables) instead of just a number in this query?
Error: invalid: type error @9:5-9:29: expected string but found int
Maybe it is possible to change the format (e.g. int to string).
Another option how to exclude multiple days without multiple “date.weekDay(t: r._time) !=” would be fine too.