# Multi value variable to multi query

**URL:** <https://community.grafana.com/t/multi-value-variable-to-multi-query/88173>\
**Category:** Time Series Panel\
**Created:** [May 23, 2023, 11:07am UTC](https://community.grafana.com/t/multi-value-variable-to-multi-query/88173 "2023-05-23T11:07:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rmack](https://avatars.discourse-cdn.com/v4/letter/r/7bcc69/32.png) [@rmack](https://community.grafana.com/u/rmack)\
**Post date:** [May 23, 2023, 11:07am UTC](https://community.grafana.com/t/multi-value-variable-to-multi-query/88173/1 "2023-05-23T11:07:28Z")

</div>

Hi Grafana community,

I am using Grafana 9.0.9 with graphite data source plugin (in mode metric tank) and am trying to create a dashboard to dynamically combine (sum) metrics from multiple paths in one Time Series Panel.

I have an additional json api datasource, where I have access to additional data.  
The goal is to expose two text fields to a dashboard user, wherein one can provide two regex. Those regex get evaluated in that json api datasource which returns some result in an additional variable, I aim to use in the query. Lets say that variable is called “host\_interface\_path”

The user enters for example “device [AB]” in the host regex field, and “[XY]” in the interface regex field, to get the sum of all combination. Lets say its:

device A interface X in  
device B interface Y in

That dashboard variable “host\_interface\_map” would than contain in the given example two paths to those metrics, like:

device\_A.InterfaceX  
device\_B.InterfaceY

I try to utilze the variable in a query like this:

sumSeries(${host\_interface\_map}.in)

If I select one value of host\_interface\_map, the metric is properly graphed in the panel.  
If I select more than one value of host\_interface\_map, the panel shows “No data”

In the query inspector, I can see that multi value of host\_interface\_map in the query above gets substituted to:  
{device\_A.InterfaceX,device\_B.InterfaceY}.in

Fine, just doesn’t work.

What works is for example: “device\_A.{InterfaceX,InterfaceY}.in”  
Unfortunately not what I need. I need device\_A.InterfaceX + device\_B.InterfaceY

I could of course have multiple query series A,B,C… and do the sum operation on those. Is there a possibility to make grafana dynamically create one query series for each value in a variable?

Maybe you guys have an idea how I could achive what I am trying to do with variables.

If I repeat the panel by the variable host\_interface\_map, the multiple instances of the time series panel gets rendered also properly by the way.

Hopefully I was able to explain properly and don’t scare everyone away with my wall of text 🙂

Cheers!

---

<div class="post-metadata">

**Author:** ![rmack](https://avatars.discourse-cdn.com/v4/letter/r/7bcc69/32.png) [@rmack](https://community.grafana.com/u/rmack)\
**Post date:** [May 23, 2023, 1:12pm UTC](https://community.grafana.com/t/multi-value-variable-to-multi-query/88173/2 "2023-05-23T13:12:58Z")

</div>

Maybe it helps to understand my issue and find a workaround:

The query series A doesn’t return any result  
I’ve entered the queries B and C manually, to show which data I’d expect from query A:

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/2/7/27ef65c9497b3b5e334d9f6b32b1ee5e7a304d44.png)

The query inspector shows this:

```auto
Object
request:Object
method:"POST"
url:"api/datasources/proxy/36/render"
data:"target=%7Bgnms_sw-int_12c_r9_bs_kae_de.Interface_port-channel1%2Cgnms_sw-int_12c_r9_bs_kae_de.Interface_Ethernet1_49%2Cgnms_sw-int_12c_r9_bs_kae_de.Interface_Ethernet1_51%7D.in&target=gnms_sw-int_12c_r9_bs_kae_de.Interface_Ethernet1_51.in&target=gnms_sw-int_12c_r9_bs_kae_de.Interface_Ethernet1_49.in&from=1684843233&until=1684846835&format=json&maxDataPoints=1548&meta=true"
hideFromInspector:false
response:Object
version:"v0.1"
meta:Object
stats:Object
series:Array[2]
0:Object
1:Object

```

I think it would work if I could change the “A”-grafana query to pass each variable value via an extra target parameter.
