Calculation of Covariance in Grafana

Calculation of pearson-correlation with Grafana/InfluxDB

Current behavior:
Calculation isn´t working, no error message. Only “No data” despite there is data in the time range.

Desired behavior:
Calculation of the pearson-correlation with the cov() function and print it on the Grafana Dashboard as Single Stat.

Alternatives considered:
Also tried pearsonr() function or grouping the tables, but nothing worked for me.

Use case:
Show correlation between two variables on the Grafana Dashboard.


Does it work in Influx Data Explorer? (toggled to Raw Data)

No. The query takes some time (about 0.5s - 1s), but still “No results”.

I think your question may be better answered on the InfluxDB forum as it does not appear to be a Grafana issue.

Got the solution by my own…I had an issue with the timestamp, because of the not matching Milliseconds.

Solved it by adding “|> truncateTimeColumn(unit: 1s)” to every query.

Thanks for your help.