Simple calculations with two or more metrics (sum, subtract, etc) with influxql/flux query?

is it possible to sum two or more metrics with influxql (or may be with flux) rather than stacking graphs or executing an expressions on them ?
For example - sum of two metrics: uplink and downlink traffic.
I.e. it possible to perform simple calculations on the metrics while retrieving them from database?
I mean something like a+b, b-c, (a+b+c)/(d+e+f).

Have you already tried using Transformations?

1 Like

As i can see - transformations take the metric and perform calculations with it. But i can’t find a transformation which could do “metric1 + metric2” for example

Have you tried something like this?
image

2 Likes

Thank you, Grant
Will check this.

also possible to select “Expression” at the bottom of the Query tab:

1 Like

msgluck, you are my hero! Expression is the solution for my calculation problem.
I did see the “+ Expression” button, but somehow ignored it

is there any way to add more than two metrics together besides doing only 2 at a time step by step with intermediate expressions?

In Grafana’s built-in transformations, I do not believe you can do more than 2 at a time. If your datasource has good query-building functions, you can (and perhaps should) do the math there.

1 Like