Simple query question: Count of points above the average

Hey! I have a question about a query. I have a timeseries of error counts. I have successfully visualised this in Grafana. I now want to add a single value stat that shows me how many points are above the average value.
I can get the total points with SELECT count(errors) FROM error_data and the average with SELECT mean(errors) FROM error_data but I can’t combine them no matter how hard I try.
Basically this is what I want: SELECT count("errors") FROM "error_data" WHERE errors > mean(errors). I’ve tried countless things but with no success. Using the result from the second query manually works:

> select count(errors) from error_data
name: error_data
time count
---- -----
0    7795

> select mean(errors) from error_data
name: error_data
time mean
---- ----
0    18.288187764524817

> SELECT count("errors") FROM "error_data" where errors > 18.328103074371732
name: error_data
time count
---- -----
0    3723

Thanks in advance!

In InfluxQL, you can’t do math across measurements. It’s one of the limitations of the language.

But you can try using Flux to do it: InfluxDB: How to Do Joins, Math across Measurements | InfluxData