I am using Grafana with InfluxDB as my data source inside Home Assistant, but I am having trouble trying to do some math between queries. What I’m trying to do is find the percent difference between the avg values of two queries, over a dynamic time range. As you can see below, I’ve managed to accomplish this exact thing, except it’s over an absolute time range. In this case, it’s giving me the percent difference between the average wind speed over the last 7 days vs. the 7 days before that.
Unfortunately, this is not all that helpful, as I would like to be able to compare only the current week so far to the completed week before it. What I have now is comparing just the last 7 days to the 7 days before that, which is not what I want. However, I can’t seem to find a method to allow me to compare this week to last week.
I know Grafana has time ranges like “now/w” which is “this week thus far”, but I am not able to put those specific time ranges into the query - it doesn’t work. Is there a way to do what I want?