# Repeat with hidden variable

**URL:** <https://community.grafana.com/t/repeat-with-hidden-variable/3465>\
**Category:** Dashboards\
**Tags:** templating\
**Created:** [October 26, 2017, 9:55pm UTC](https://community.grafana.com/t/repeat-with-hidden-variable/3465 "2017-10-26T21:55:12Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![ulope](https://avatars.discourse-cdn.com/v4/letter/u/9e8a1a/32.png) [@ulope](https://community.grafana.com/u/ulope)\
**Post date:** [October 26, 2017, 9:55pm UTC](https://community.grafana.com/t/repeat-with-hidden-variable/3465/1 "2017-10-26T21:55:12Z")

</div>

Hi,

I’m trying to get a panel to repeat for every value of a variable but I don’t want the user to be able to have control over this variable (i.e. it should be hidden).

Is there any way to achieve this?

Thanks.

---

<div class="post-metadata">

**Author:** ![anon34853223](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@anon34853223](https://community.grafana.com/u/anon34853223)\
**Post date:** [November 21, 2017, 8:59am UTC](https://community.grafana.com/t/repeat-with-hidden-variable/3465/2 "2017-11-21T08:59:29Z")

</div>

Hi,

Yes, you can select Hide=Variable, see screenshot below:

 ![image](https://us1.discourse-cdn.com/grafana/original/2X/0/0fec364a380b0ff3f36dc7db75f3b5fdad6f5526.png)

You can play with this [here](http://play.grafana.org/dashboard/db/graphite-templated-nested?orgId=1).

Good luck

Marcus

---

<div class="post-metadata">

**Author:** ![ulope](https://avatars.discourse-cdn.com/v4/letter/u/9e8a1a/32.png) [@ulope](https://community.grafana.com/u/ulope)\
**Post date:** [November 21, 2017, 12:01pm UTC](https://community.grafana.com/t/repeat-with-hidden-variable/3465/3 "2017-11-21T12:01:40Z")

</div>

Thanks for the answer. Unfortunately, it doesn’t answer my question.

I know that I can set a variable to hidden. The question is how I can then use this hidden variable to repeat a row or panel.

---

<div class="post-metadata">

**Author:** ![anon34853223](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@anon34853223](https://community.grafana.com/u/anon34853223)\
**Post date:** [November 21, 2017, 12:54pm UTC](https://community.grafana.com/t/repeat-with-hidden-variable/3465/4 "2017-11-21T12:54:18Z")

</div>

Hi,

Understood. So you can use a template variable to repeat either a row or a panel. If you look at [http://play.grafana.org/dashboard/db/graphite-templated-nested?orgId=1&panelId=3&fullscreen&edit&tab=general](http://play.grafana.org/dashboard/db/graphite-templated-nested?orgId=1&panelId=3&fullscreen&edit&tab=general) you can see that the _server_ template variable have been set to repeat panels.

You can repeat by panels:

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

And you can repeat by rows:

 ![image](https://us1.discourse-cdn.com/grafana/original/2X/1/144b7781ff4ef94b6e1847f2205b0b0d5cfa199a.png)

See [templating documentation](http://docs.grafana.org/reference/templating/#templating) for more information.

Hope this makes it more clear

Marcus

---

<div class="post-metadata">

**Author:** ![ulope](https://avatars.discourse-cdn.com/v4/letter/u/9e8a1a/32.png) [@ulope](https://community.grafana.com/u/ulope)\
**Post date:** [November 21, 2017, 2:03pm UTC](https://community.grafana.com/t/repeat-with-hidden-variable/3465/5 "2017-11-21T14:03:14Z")

</div>

I’m sorry, maybe I phrased my initial question confusingly.  
Let me try again in the most straightforward manner possible:

I want to repeat a panel or row by all values of a hidden variable.

Is that possible?

Thanks

---

<div class="post-metadata">

**Author:** ![anon34853223](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@anon34853223](https://community.grafana.com/u/anon34853223)\
**Post date:** [November 21, 2017, 3:47pm UTC](https://community.grafana.com/t/repeat-with-hidden-variable/3465/6 "2017-11-21T15:47:56Z")

</div>

No worries.

> [@ulope](#):
>
> I want to repeat a panel or row by all values of a hidden variable.
> 
> Is that possible?

Yes you can.

So in my example above I used a template variable of type Query. For that type you use a query against a datasource and returns a list of values that you can use to repeat a panel or row while having the template variable hidden.

In below example I’m using a template variable of type Custom where I’ve defined three values backend\_01, backend\_02 and backend\_03 and set it to hidden and repeating the panels below so that a I get one panel each for backend\_01, backend\_02 and backend\_03.

 ![image](https://us1.discourse-cdn.com/grafana/original/2X/a/a63369c261ce2a2efdb32250b6bdd1c81b1cc435.png)

Marcus

---

<div class="post-metadata">

**Author:** ![ulope](https://avatars.discourse-cdn.com/v4/letter/u/9e8a1a/32.png) [@ulope](https://community.grafana.com/u/ulope)\
**Post date:** [November 21, 2017, 5:28pm UTC](https://community.grafana.com/t/repeat-with-hidden-variable/3465/7 "2017-11-21T17:28:27Z")

</div>

Hm this doesn’t work for me.  
The variable only ever holds the first value. If I set it to visible and check all values repetition of course works as expected.

Probably important detail I forgot to mention: I’m using prometheus as datasource

Here is the configuration I’m using:  
Template:

 ![18](https://us1.discourse-cdn.com/grafana/original/2X/3/3b4929a6ee1918f4bafa7de23689a79e3be0e06f.jpg)

Panel “General” tab:

 ![07](https://us1.discourse-cdn.com/grafana/original/2X/f/fce77e30ec4948939a6711064044850d963fd83b.jpg)

---

<div class="post-metadata">

**Author:** ![ulope](https://avatars.discourse-cdn.com/v4/letter/u/9e8a1a/32.png) [@ulope](https://community.grafana.com/u/ulope)\
**Post date:** [November 21, 2017, 5:30pm UTC](https://community.grafana.com/t/repeat-with-hidden-variable/3465/8 "2017-11-21T17:30:18Z")

</div>

Panel “Metrics” tab:

 ![24](https://us1.discourse-cdn.com/grafana/original/2X/2/2e0cbf11099c92d7781de47c486685c513f397b4.jpg)

Result:

 ![50](https://us1.discourse-cdn.com/grafana/original/2X/2/2ef96d8d631f1269fe0503cf20585997b5e36147.png)

---

<div class="post-metadata">

**Author:** ![anon34853223](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@anon34853223](https://community.grafana.com/u/anon34853223)\
**Post date:** [November 22, 2017, 6:40pm UTC](https://community.grafana.com/t/repeat-with-hidden-variable/3465/9 "2017-11-22T18:40:55Z")

</div>

Hi,

I’ve verified that your above configuration works, at least on the latest version of Grafana.

Make sure to save your dashboard and then reload the browser to make sure that your settings have been updated in UI. I didn’t need to do this though, but I verified that it still works after I saved it, navigate to home and then back to dashboard.

Please see my configuration screenshots below using Prometheus as datasource:

Template variable setting:  
(First, variable are not hidden so that I can select the values I’m interested in, see _Selecting two values out of 3:_ below)

 ![image](https://us1.discourse-cdn.com/grafana/original/2X/a/a2d9be6ff5256ae3667d43dd41d1faa7f76897a4.png)

Singlestat panel settings:

 ![image](https://us1.discourse-cdn.com/grafana/original/2X/0/04261df5274aba5fe6a7306ddb736077d5d184d6.png)

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

Selecting two values out of 3:

 ![image](https://us1.discourse-cdn.com/grafana/original/2X/5/521716f72943db91db6fc3f2d1ab8c74e860f3c3.png)

Then I hide the variable according to _Template variable setting_ screenshot above.

And final result:

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

I think my configuration are exactly like yours. What version of Grafana are you using?

Marcus

---

<div class="post-metadata">

**Author:** ![ulope](https://avatars.discourse-cdn.com/v4/letter/u/9e8a1a/32.png) [@ulope](https://community.grafana.com/u/ulope)\
**Post date:** [November 23, 2017, 12:21pm UTC](https://community.grafana.com/t/repeat-with-hidden-variable/3465/10 "2017-11-23T12:21:05Z")

</div>

> [@anon34853223](#):
>
> (First, variable are not hidden so that I can select the values I’m interested in, see _Selecting two values out of 3:_ below)

Ok! Now we’re getting to the root of this!  
I’m hoping for a solution that doesn’t require manual selection of the target hosts. In our environment hosts are added semi-frequently and I’d like the dashboards to automatically adapt by showing all hosts that match the template variable query.

---

<div class="post-metadata">

**Author:** ![anon34853223](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@anon34853223](https://community.grafana.com/u/anon34853223)\
**Post date:** [November 23, 2017, 4:00pm UTC](https://community.grafana.com/t/repeat-with-hidden-variable/3465/11 "2017-11-23T16:00:26Z")

</div>

Hi,

Okay. So if you want to repeat for all values/hosts (even if hosts come and go) you want to select _Include All option_ when configuring your template variable. Then you just need to make sure that the manual selection of _All_ are set and you would never need to update that again.

Marcus

---

<div class="post-metadata">

**Author:** ![julianor](https://avatars.discourse-cdn.com/v4/letter/j/ecccb3/32.png) [@julianor](https://community.grafana.com/u/julianor)\
**Post date:** [January 22, 2018, 1:22pm UTC](https://community.grafana.com/t/repeat-with-hidden-variable/3465/12 "2018-01-22T13:22:44Z")

</div>

Hi,

Is it possible in templating put a checkbox when I select “Include All option” to check All for default ?

Then I dont need to manual select.

Juliano

---

<div class="post-metadata">

**Author:** ![julianor](https://avatars.discourse-cdn.com/v4/letter/j/ecccb3/32.png) [@julianor](https://community.grafana.com/u/julianor)\
**Post date:** [January 23, 2018, 12:14pm UTC](https://community.grafana.com/t/repeat-with-hidden-variable/3465/13 "2018-01-23T12:14:45Z")

</div>

Hi,

I found a solution for this, with help of my friends of “Grafana Brasil” group in telegram:

- Create the variable which “Include All option” not hidden.
- In dashboard select “All” on this variable
- Save the dashboad
- Edit the variable to hidden
- Save the dashboard

Juliano

---

<div class="post-metadata">

**Author:** ![caviman2201](https://avatars.discourse-cdn.com/v4/letter/c/958977/32.png) [@caviman2201](https://community.grafana.com/u/caviman2201)\
**Post date:** [April 4, 2019, 7:16pm UTC](https://community.grafana.com/t/repeat-with-hidden-variable/3465/14 "2019-04-04T19:16:10Z")

</div>

This just helped me as well… thank you. Seems like an odd functionality.

---

<div class="post-metadata">

**Author:** ![saikishore209](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@saikishore209](https://community.grafana.com/u/saikishore209)\
**Post date:** [June 23, 2020, 12:58am UTC](https://community.grafana.com/t/repeat-with-hidden-variable/3465/15 "2020-06-23T00:58:44Z")

</div>

Hi , i have similar task to do but using Influxdb…  
I have created custom variables as query is not working for me, now whole issue is, if i select more than one from drop down it displays as “no data”

---

<div class="post-metadata">

**Author:** ![ef62mkv](https://avatars.discourse-cdn.com/v4/letter/e/7feea3/32.png) [@ef62mkv](https://community.grafana.com/u/ef62mkv)\
**Post date:** [January 16, 2024, 3:01pm UTC](https://community.grafana.com/t/repeat-with-hidden-variable/3465/16 "2024-01-16T15:01:59Z")

</div>

my gosh, this is _SO_ counter-intuitive … I had to read this thread to almost the end to get to the bottom of it. Why is there no proper way to define a hidden variable that just “emits” all it’s values for repetition?

---

<div class="post-metadata">

**Author:** ![sirianni](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/sirianni/32/54659_2.png) [@sirianni](https://community.grafana.com/u/sirianni)\
**Post date:** [May 16, 2025, 8:39pm UTC](https://community.grafana.com/t/repeat-with-hidden-variable/3465/17 "2025-05-16T20:39:25Z")

</div>

7 years later and this solution is still going strong!

Thanks @julianor !!!
