Two different series, in same panel, each one being the sum of multiple different queries

Hi, I’m on Grafana version 10.3.3, and I have a panel where i have around 10 queries. I’d like to have as an output two different series, one being the sum of queries from 1 to 5, and the other being the sum of queries from 6 to 10.

I’ve already accomplished the first series, by using the “Add field from calculation” Transformation. I can’t do the same adding another transformation “Add field from calculation” because in the Operation field i don’t have all the queries as i have in the first transformation, but just the total of the first transformation. I can’t use the filter option cause it let me select only one query per time

Moreover it doesn’t create a new series, but it adds all on the only series it shows in the panel.

I’ve looked in the forum but couldn’t find what can save my day, anyone willing to help or at least point me in the right direction?

Thanks in advance

Welcome @eaielli to the Grafana forum.

Sounds like you may have run into some limitations with the Grafana transformations. If they are indeed limitations, could you instead do the sum of queries 1-5 in your actual query (vs in Grafana)? What is your datasource and can you share the queries?

1 Like

Hi Grant!

thanks for your time. My datasource is zabbix, and in my query i just select an item proposed from zabbix (in this case, the incoming and the outgoing traffic of a switch port).

I think i can do the math in zabbix and then just export it, if i can’t find a way to do that in grafana :slight_smile:
Let me know if you need more info or if you have ideas to try

Have a nice day!

@eaielli Thanks for explaining

@isaqueprofeta Any ideas?

1 Like

Hey @grant2! And hi @eaielli,

In this case I’d prefer to do two queries. Each of them using some regex to aggregate the data of each needed serie (1 to 5 and 6 to 10) on the query directly and use the sumSeries() function from the datasource.

Query A:
/My item number (1|2|3|4|5)/
sumSeries()

Query B:
/My item number (6|7|8|9|10)/
sumSeries()

If the regex couldn’t be done like above, because the item naming complexity, then I’d edit the needed Items to some Tags on Zabbix side like “Grafana:Items1to5” and “Grafana:Items6to10” and filter by the Tag, getting all the items from it. (same sumSeries function from datasource to aggregate).

Also try to look at this post here on community: Total traffic consumption of an interface - #11

Hope it helps!

1 Like

Hi @isaqueprofeta!

I definitely managed to solve my issue, with your hints, precisely i did this:

first, created two new queries with regex on the items getting all the items i needed
In both queries i utilized the function sumSeries()

I then deleted all the other queries and the transformation, and right now i have my panel with two series as needed.

Many many thanks, you and @grant2 saved my day!!

Have a nice day!

1 Like