Variable with value mappings

I have defined a variable. Example $belegeRezept.

If I set this is the title field of a dashboard the value shows up.

However it does not seem to work with value mappings.

Example Value mappings: type:
Value to text
1 $belegeRezept

The text will be shown as $belegeRezept and not the variable value

Are variables supported for value mappings?


Hello there, I have the same problem as yours. I was trying to use a defined dashboard variable in value mappings in my stat panel, but it just didn’t work. However, I read the official documentation of value mapping and it says that value mapping accepts variables, which is pretty confusing. Have you figured out this problem? Is it us that use variables incorrectly or it is actually a function that had not yet been added to Grafana?


We also have the same issue where we wish to convert a query values to a more friendly display names base on a variable or a dynamic value mapping based on a query.

Im facing the same problem. I want to display the query values to show in a more friendly display too, did u fixed this?

1 Like

Hi @horselessname, @natasha1 and other users.

I know that the original post is almost 2 years old and not sure if all of the users are still active or have found a possible solution or workaround.

Can you still try to reproduce it on and write down the steps of reproduction so that the community can try to help you out?


Hi! @usman.ahmad ,

Hi @dpkhm ,

Thanks for this.

Can you please write the steps of reproduction so that I try to replicate it in the lab environment?

Also would be nice if you could share the link to so that I can check it out once you reproduce it.


Step by step:

  1. Create a dashboard
  2. Create a variable
  3. Use this variable in Value Mappings to replace the corresponding regular expression

In, I don’t have permission to create a dashboard.

Hi @dpkhm,

Thanks. So I had a chance to talk with the developers and after looking in more detail inside the code it is not possible to what you want to achieve as Variables are not supported inside value mappings.

From the code, it treats it as text so will not work.

Also, cross-referenced with the documentation and it does also say anything which supports Variables.

There was already a question on this topic recently on this post which seems to have the same answer by the member.

Hi, @usman.ahmad

Will this functionality be added in future releases? It is very useful when implementing dynamic dashboards.

Hi @dpkhm,

Well, I do understand as this could make the Dashboards v.dynamic and make sense to request this as a Feature request.

Please, report this to our official GitHub Discussions page by providing all the details (you can simply copy/paste most of the text + screenshots) and then select the correct category there.

This way our Engineers can upvote it and get will become a discussion topic for the next future release

Ok, i did it:
Variable in "Value Mappings", "Thresholds" · Discussion #58834 · grafana/grafana · GitHub