Change Grafana query dynamically based on user inputs

Is there any way to change the grafana query on the basis of value(variable) selected in grafana dropdown.

Assume that there is a dropdown in grafana dashboard which has values query1 and query2.

Note: We have used MySQL as database

If user selects query1 then query to be executed is:

select time, val1
from temperature
where temp = 10;

If user selects query2 then query to be executed is:

select time, humid
from humidity
where humidity = 50;

Hi Sarath, you can do that if you use templating variables.

If after reading this, you have doubts i can help you!

1 Like