Average of this week vs Average of Last week


We are using InfluxDB and I would like to know how can I compare a average of this hour vs the average of the same hour 7 days back.

I have two queries below, that does gives me just the value but I can’t seem to find a way to do a math between two queries.

I do not want to use an absolute value in the timerange as I want the system to use the current date & time and minus -7 days from now.

SELECT mean(“value”) AS “Last 7 days” FROM “xxxxtablexxx”.“xxxtablexx” WHERE (“process” = ‘x’ AND “xxx” = ‘a value’ AND time > now() - 7d) GROUP BY time(4h), “xxx”

SELECT mean(“value”) AS “Previous Week” FROM “xxxxtablexxx”.“xxxtablexx” WHERE (“process” = ‘x’ AND “xxx” = ‘a value’ AND time > now() - 14d AND time <now() - 7d) GROUP BY time(4h), “xxx”