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.
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.
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