Grafana add constant variable -- for prometheus query

I want to add a variable in my dashboard dropdown column in my grafana dashboard that can be chosen.

I went to settings and added variable and noticed that I can choose constant variable — however that constant can only be one value.

I want to make a dropdown variable on dashboard – that can choose from list of constant variables.

Example – I want to make a variable Fruit and instead of setting its value as just apple — I wan to set it to apple or banana or orange. I want these 3 options to show up as a downdrop that can choose from for Fruits variable.

in my metric I want to be able to select from this dropdown and pass as a name in my query
I want to pass name=".$apple."

Hello @rnayar, for this you can use Custom variable type instead of Constant. You can learn more about variable types in this documentation.

1 Like

thank you so much! It worked!

I was also wondering if you know how to make variables for each of the different panels in the same dashboard? I want to make multiple panels; however, each of them I want to filter based on different set of variables… is there a way to have multiple panels with different variables for each of them?

Please let me know if you know how to select multiple variables for different panels in dashroom. It’s very urgent for me. Regards! Cheers!

Template variables are variables on a dashboard level. So you can’t set them on panel level. But you can create more variables and use just the ones you want in each panel. Or you can create multiple dashboards.