# Using variables to turn off queries

**URL:** <https://community.grafana.com/t/using-variables-to-turn-off-queries/37840>\
**Category:** Dashboards\
**Tags:** dashboard-variables, templating, mysql\
**Created:** [October 12, 2020, 5:20pm UTC](https://community.grafana.com/t/using-variables-to-turn-off-queries/37840 "2020-10-12T17:20:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tna331](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@tna331](https://community.grafana.com/u/tna331)\
**Post date:** [October 12, 2020, 5:20pm UTC](https://community.grafana.com/t/using-variables-to-turn-off-queries/37840/1 "2020-10-12T17:20:17Z")

</div>

I am using MSSQL and have a panel with 5 queries graphed. I would like to have a dropdown at the top that allows me to pick which things I want graphed. I can’t find an example of this being done with SQL. I know I can click on the lines in the legend, but I have several similar panels on the dashboard and would like to do it using the variable drop down. What is the best way to accomplish this?

---

<div class="post-metadata">

**Author:** ![fadjar340](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/fadjar340/32/10236_2.png) [@fadjar340](https://community.grafana.com/u/fadjar340)\
**Post date:** [October 13, 2020, 9:32am UTC](https://community.grafana.com/t/using-variables-to-turn-off-queries/37840/2 "2020-10-13T09:32:19Z")

</div>

Please read this:

> **[Templates and variables](https://grafana.com/docs/grafana/latest/variables/)**
>
> Templates and variables A variable is a placeholder for a value. You can use variables in metric queries and in panel titles. So when you change the value, …

---

<div class="post-metadata">

**Author:** ![tna331](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@tna331](https://community.grafana.com/u/tna331)\
**Post date:** [October 13, 2020, 3:57pm UTC](https://community.grafana.com/t/using-variables-to-turn-off-queries/37840/3 "2020-10-13T15:57:52Z")

</div>

I have read that, and I apologize for my confusion but I am having a hard time understanding how to use this to turn off a query? The examples show options that are not visible in my queries. I think this is because I am using MSSQ and the examples are in other databases.

I have the variable at the top, but how do I use this to turn off or turn on queries?

---

<div class="post-metadata">

**Author:** ![toms130](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/toms130/32/103_2.png) [@toms130](https://community.grafana.com/u/toms130)\
**Post date:** [December 28, 2022, 11:38am UTC](https://community.grafana.com/t/using-variables-to-turn-off-queries/37840/4 "2022-12-28T11:38:05Z")

</div>

Hi, I’m also interested by doing this, does anyone knows how to do this ?

---

<div class="post-metadata">

**Author:** ![fadjar340](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/fadjar340/32/10236_2.png) [@fadjar340](https://community.grafana.com/u/fadjar340)\
**Post date:** [February 15, 2024, 4:51am UTC](https://community.grafana.com/t/using-variables-to-turn-off-queries/37840/5 "2024-02-15T04:51:43Z")

</div>

Where do you get the variable from the database or other sources?  
After you can get the variable value, you can use it as drop down
