Can I divide a derivative of a field with the values of another filed?


I am using derivative to calculate the delta between two samples. This calculates the bytes/sec. However I want to display the B/s per subscriber. I tried to divide by a field that shows the number of subscribers but Grafana doesnt like it.

SELECT (derivative(“downlinkBytes”, 5m))/“defaultbearersActive” FROM “apnstatistics” WHERE “apn” =~ /^$APN$/ AND “host” =~ /^$GGSN$/ AND $timeFilter

Unfortunately InfluxDB doesn’t support math across series (yet). I know it’s something they’re working on, and consider important. You can see the issue, which is one of the most commented:

If this is a critical feature for you, you have two choices: (1) Wait for InfluxDB to add the feature; or (2) Use a TSDB that allows math across series, like Graphite or Prometheus.

Hope this helps!

Hello, they are from the same series. The problem seems to be that one is an aggregation and the other a raw field. How can I overcome this?

InfluxDB Error Response: error parsing query: binary expressions cannot mix aggregates and raw fields


The solution was not to use a raw field. In order to do that i had to use the mean of the measurements. Why is that though?

SELECT derivative(mean(“downlinkBytes”), 1s)/mean(“defaultbearersActive”) FROM “apnstatistics” WHERE “apn” =~ /^$APN$/ AND “host” =~ /^$GGSN$/ AND $timeFilter GROUP BY time($interval)