I am trying to find a way to calculate the value of every datapoint as a percent of its daily mean (i.e. this point was 135% of the daily mean, that one was 23%), and its standard score. I am using InfluxDB v1.4 and Grafana v5.1.4.
The two queries that I am using for the following graph are:
SELECT mean("value") FROM "generic"."InfluxDB" WHERE $timeFilter GROUP BY time(1d) fill(null)
SELECT "value" FROM "generic"."InfluxDB" WHERE $timeFilter
Intuitively, I thought that the query which would give me the percent of daily mean was going to be
SELECT ("value") / mean("value") FROM "generic"."InfluxDB" WHERE $timeFilter GROUP BY time(1d) fill(null)
- for standard score it would be
("value" - mean("value")) / stddev("value")
However, InfluxDB, like most databases, does not support mixing aggregated data and unaggregated data in the same query.
Does anybody know how to go about this using a query that Grafana can understand? Also, I do not have access to Kapacitor to help here.
I have looked into subqueries a bit, which looked promising but haven’t gotten me much further.
Any guidance is appreciated.