Grafana - Adding ( Summing) 2 different queries

Hi all,

I’ve been working on my dashboard and i would like to add a sum of two values in a graph:

Here is my query config:

So i have two queries that are monitoring the traffic , and i would like to add the sum of those two values on the same graph. As you can see, when i do transformation, it can’t sum it up. But, i’ve read and tried to do some other transformations, expressions etc but it didn’t help. Somwhere it said it was because of timestamps that are different. Does anyone know how to solve this? Basicly these are two different routeres and i need the sum of the bandwith. Thank you very much!

before your 1st transformation, can you try adding a convert field type transformation, and make them numbers and see if it will add them correctly then?

Can you give me an example?

I’ve tried like this but still doesn’t do the calculation:

Hi @stevanovicmarko1994 and welcome.

Could you click the pencil icon on your two queries to get the full InfluxQL text, and then begin each query using the last() selector, like this:

SELECT last("value") FROM...

Hi Grant,

When i add last like this:

I get data error. And when i do it like this:

SELECT last(“value”) non_negative_derivative(“bytes_received”, 1s) *8 FROM “Cisco-IOS-XR-infra-statsd-oper:infra-statistics/interfaces/interface/latest/generic-counters” WHERE (“source”::tag = ‘DROGON’ AND “interface_name”::tag = ‘HundredGigE0/3/0/1’) AND $timeFilter

It just doesn’t “save” it when i switch to editor mode.

What is the error when you hover over the red triangle?

It says:

InfluxDB Error: not executed

I would try to spend some time debugging the query using the query editor in InfluxDB (not sure which version of InfluxDB you are running, but the latest Cloud product has InfluxQL query editor). I believe the crux of the problem is that you have different timestamps for the two series and I believe that using the last() function will correct this and make it possible to add them in Grafana.

Also, you could try going back to your original (working) queries and try using this type of transformation:
image

1 Like