# Set a variable for just one panel

**URL:** <https://community.grafana.com/t/set-a-variable-for-just-one-panel/112113>\
**Category:** Configuration\
**Created:** [January 16, 2024, 4:09pm UTC](https://community.grafana.com/t/set-a-variable-for-just-one-panel/112113 "2024-01-16T16:09:58Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![munafoa](https://avatars.discourse-cdn.com/v4/letter/m/ecb155/32.png) [@munafoa](https://community.grafana.com/u/munafoa)\
**Post date:** [January 16, 2024, 4:09pm UTC](https://community.grafana.com/t/set-a-variable-for-just-one-panel/112113/1 "2024-01-16T16:09:59Z")

</div>

hi everyone, i have kind of hard question. I have a dashboard with many panels in it. i wanna set a variable just for one of these panels, not for all. is it possible??  
thanks a lot!

---

<div class="post-metadata">

**Author:** ![jangaraj](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/jangaraj/32/39197_2.png) [@jangaraj](https://community.grafana.com/u/jangaraj)\
**Post date:** [January 16, 2024, 4:22pm UTC](https://community.grafana.com/t/set-a-variable-for-just-one-panel/112113/2 "2024-01-16T16:22:27Z")

</div>

Why it is hard question? Just create dashboard variable and use that dashboard variable only for that one particular panel.

---

<div class="post-metadata">

**Author:** ![munafoa](https://avatars.discourse-cdn.com/v4/letter/m/ecb155/32.png) [@munafoa](https://community.grafana.com/u/munafoa)\
**Post date:** [January 16, 2024, 4:37pm UTC](https://community.grafana.com/t/set-a-variable-for-just-one-panel/112113/3 "2024-01-16T16:37:48Z")

</div>

Ok thanks per the reply. But how can i do that? I see that when i set a variable, it is for all the panel in the dashboard.

---

<div class="post-metadata">

**Author:** ![jangaraj](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/jangaraj/32/39197_2.png) [@jangaraj](https://community.grafana.com/u/jangaraj)\
**Post date:** [January 16, 2024, 7:27pm UTC](https://community.grafana.com/t/set-a-variable-for-just-one-panel/112113/4 "2024-01-16T19:27:28Z")

</div>

Just to clarify: [dashboard variables](https://grafana.com/docs/grafana/latest/dashboards/variables/) are defined per dashboard, not per panel - that’s a reason, why they are always on the top - you can’t move them as panels

Any panel can (but don’t have to) use that dashboard variable(s). It can use 0, 1 or many of those dashboard variables.

I assume based on your confusion that you mean something different than you asked in the first post (wrong question = wrong answer).

I guess your actual question is: I want to have “panel” variable (visual select box):

- which is defined on the panel level
- which is visually on the panel level
- which moves with that panel
- which is accesible only by that panel
- which can be used by any panel type
- …

For example:

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/f/e/fea5981f66e5e4bf1f96da97b9fa421fe46295d9.png)  
Answer: that’s not possible - see clarification

---

<div class="post-metadata">

**Author:** ![munafoa](https://avatars.discourse-cdn.com/v4/letter/m/ecb155/32.png) [@munafoa](https://community.grafana.com/u/munafoa)\
**Post date:** [January 17, 2024, 8:13am UTC](https://community.grafana.com/t/set-a-variable-for-just-one-panel/112113/5 "2024-01-17T08:13:44Z")

</div>

Ok thank you for replying! I cannot set a variable for just one panel, but what if i want to remove some panels from the repeating? I set a variable, and i have all my panels; now my question is: can i remove some panels after setting a variable?

---

<div class="post-metadata">

**Author:** ![codi639](https://avatars.discourse-cdn.com/v4/letter/c/ba9def/32.png) [@codi639](https://community.grafana.com/u/codi639)\
**Post date:** [January 17, 2024, 8:17am UTC](https://community.grafana.com/t/set-a-variable-for-just-one-panel/112113/6 "2024-01-17T08:17:29Z")

</div>

You can put, instead, the `multi-value` option for your variable.

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/9/6/964538a8b3fe93e21757984bddaefbd29839e888.png)  
And then select only the value you wanna repeat…  
 ![image](https://us1.discourse-cdn.com/grafana/original/3X/2/a/2a4fdabe8e6a893af1e9cbac112cc8f445e7d6bf.png)

Please not that if you don’t want to have to reselect all the value each time. You can save your dashboard with the value of the variable by selecting `Save current variable values as dashboard default`:  
 ![image](https://us1.discourse-cdn.com/grafana/original/3X/b/4/b4f2e935e946babd685d873eaa1d035cf70573c2.png)

---

<div class="post-metadata">

**Author:** ![munafoa](https://avatars.discourse-cdn.com/v4/letter/m/ecb155/32.png) [@munafoa](https://community.grafana.com/u/munafoa)\
**Post date:** [January 17, 2024, 8:52am UTC](https://community.grafana.com/t/set-a-variable-for-just-one-panel/112113/7 "2024-01-17T08:52:04Z")

</div>

Hi! Thanks for the reply. I took a look to these options, but i don’t think that is helpful in my situation.  
Now I will explain my case in details: I have 18 plants (cluster) that i want to repeat. I set a variable and it works fine. In each of these plants there are a certain number of services that i wanna monitor. I created one panel for each services. So, for each plant I have a “general” panel, and a certain number of others panel, one for each services.  
Now I have the problem: the repeating variable work on the 18 plants, and also works on the single services. i don’t want that, because the plants don’t have the same service. I just want that for every plants i have the right services.

---

<div class="post-metadata">

**Author:** ![codi639](https://avatars.discourse-cdn.com/v4/letter/c/ba9def/32.png) [@codi639](https://community.grafana.com/u/codi639)\
**Post date:** [January 17, 2024, 9:01am UTC](https://community.grafana.com/t/set-a-variable-for-just-one-panel/112113/8 "2024-01-17T09:01:47Z")

</div>

Are you using the row repeating option, or the panel repeating option?  
I’ve never done that before, but maybe by combining the row repeat with the panel one you can achieve what you want?  
Or you really just want to exclude specific values? I’m not sure but I think you can achieve that by using REGEX…

---

<div class="post-metadata">

**Author:** ![munafoa](https://avatars.discourse-cdn.com/v4/letter/m/ecb155/32.png) [@munafoa](https://community.grafana.com/u/munafoa)\
**Post date:** [January 17, 2024, 9:06am UTC](https://community.grafana.com/t/set-a-variable-for-just-one-panel/112113/9 "2024-01-17T09:06:29Z")

</div>

I’m using the panel repeating option. I’ve never used the row repeating, but I will try to combine them. My gol is having the rigth services in each plant, that’s all. If the plant X has 10 services, I wanna show just them.  
Furthermore, Do you mean REGEX when i define the variable?

---

<div class="post-metadata">

**Author:** ![codi639](https://avatars.discourse-cdn.com/v4/letter/c/ba9def/32.png) [@codi639](https://community.grafana.com/u/codi639)\
**Post date:** [January 17, 2024, 9:13am UTC](https://community.grafana.com/t/set-a-variable-for-just-one-panel/112113/10 "2024-01-17T09:13:11Z")

</div>

Could you provide us the output of your variable, if not an example?

---

<div class="post-metadata">

**Author:** ![munafoa](https://avatars.discourse-cdn.com/v4/letter/m/ecb155/32.png) [@munafoa](https://community.grafana.com/u/munafoa)\
**Post date:** [January 17, 2024, 9:21am UTC](https://community.grafana.com/t/set-a-variable-for-just-one-panel/112113/11 "2024-01-17T09:21:36Z")

</div>

I don’t think i can, it’s company staff.  
Thanks anyway for your support

---

<div class="post-metadata">

**Author:** ![codi639](https://avatars.discourse-cdn.com/v4/letter/c/ba9def/32.png) [@codi639](https://community.grafana.com/u/codi639)\
**Post date:** [January 17, 2024, 9:33am UTC](https://community.grafana.com/t/set-a-variable-for-just-one-panel/112113/12 "2024-01-17T09:33:23Z")

</div>

All good, I understand!  
I think you can achieve what you want by using two variables.  
One getting each of yours plants, and another one to get each services of each plants, for example:  
working with InfluxDB, I have a variable to get my networks names:

```auto
SHOW TAG VALUES ON supervision FROM snmp WITH KEY = network

```

and then I get every routerIP from each network:

```auto
SHOW TAG VALUES ON supervision FROM snmp WITH KEY = agent_host WHERE network =~ /^$network$/

```

With this, I can configure repeat option row with the networks variable, and create panels that repeat for routerIP.

I think that might works if you iterate your row trough the plants variable, and then the panel trough the services variable… Let me know how it goes

---

<div class="post-metadata">

**Author:** ![munafoa](https://avatars.discourse-cdn.com/v4/letter/m/ecb155/32.png) [@munafoa](https://community.grafana.com/u/munafoa)\
**Post date:** [January 17, 2024, 9:35am UTC](https://community.grafana.com/t/set-a-variable-for-just-one-panel/112113/13 "2024-01-17T09:35:53Z")

</div>

Ok thanks again. I’ll try and I’ll let you know!!
