# How to use multiple value variable in PromQL query?

**URL:** <https://community.grafana.com/t/how-to-use-multiple-value-variable-in-promql-query/163350>\
**Category:** Prometheus\
**Tags:** dashboard-variables\
**Created:** [June 18, 2026, 6:27pm UTC](https://community.grafana.com/t/how-to-use-multiple-value-variable-in-promql-query/163350 "2026-06-18T18:27:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mirtobusico](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/mirtobusico/32/58357_2.png) [@mirtobusico](https://community.grafana.com/u/mirtobusico)\
**Post date:** [June 18, 2026, 6:27pm UTC](https://community.grafana.com/t/how-to-use-multiple-value-variable-in-promql-query/163350/1 "2026-06-18T18:27:06Z")

</div>

Hi all,

I would like to use a multi value variable in a query.

In a test dashboard I have a variable (group) that identifies various devices in my lan

The variable shows correctly the groups from smokeping-prober

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/5/b/5b13435aeaae591d366e4343eb6b2d13def75c57.png)

and it works correctly if I select only one group

the query is defined as

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/4/3/43aa2ab7c6987bae924743af23a262f07a72718f.jpeg)

The query is

```auto
sum by(host) (rate(smokeping_response_duration_seconds_sum{group="$GROUP"}[$__rate_interval]))

```

Selecting “All” or more than 1 value gives a “No data” panel

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/b/9/b94df5ebd074e71b4abe32dce1dd69868a49d6fd.png)

What I’m doing wrong?

BTW if it can be of any interest the smokeping-prober yaml file is

```auto
---
targets:
- hosts:
  - cloudflare-dns
  - google-dns
  labels:
    group: dns

- hosts:
  - nexxt-int
  - p9-principale-ext
  labels:
    group: net1-device

- hosts:
  - mostro
  - kit-studio
  labels:
    group: net1-server

- hosts:
  - bianco500
  labels:
    group: net68-server

  interval: 1s # Duration, Default 1s.
  network: ip # One of ip, ip4, ip6. Default: ip (automatic IPv4/IPv6)
  protocol: icmp # One of icmp, udp. Default: icmp (Requires privileged operation)
  size: 56 # Packet data size in bytes. Default 56 (Range: 24 - 65535)

```

---

<div class="post-metadata">

**Author:** ![mirtobusico](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/mirtobusico/32/58357_2.png) [@mirtobusico](https://community.grafana.com/u/mirtobusico)\
**Post date:** [June 18, 2026, 7:23pm UTC](https://community.grafana.com/t/how-to-use-multiple-value-variable-in-promql-query/163350/2 "2026-06-18T19:23:54Z")

</div>

Found the solution: **add “~” to the query**

```auto
sum by(host) (rate(smokeping_response_duration_seconds_sum{group=~"$GROUP"}[$__rate_interval]))

```
