# Is there a way to define dashboards variables with human-readable keys?

**URL:** <https://community.dynatrace.com/t/is-there-a-way-to-define-dashboards-variables-with-human-readable-keys/50645>\
**Category:** Dashboarding\
**Tags:** dashboards\
**Created:** [March 10, 2025, 8:05pm UTC](https://community.dynatrace.com/t/is-there-a-way-to-define-dashboards-variables-with-human-readable-keys/50645 "2025-03-10T20:05:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![strudeau](https://avatars.discourse-cdn.com/v4/letter/s/6a8cbe/32.png) [@strudeau](https://community.dynatrace.com/u/strudeau)\
**Post date:** [March 10, 2025, 8:05pm UTC](https://community.dynatrace.com/t/is-there-a-way-to-define-dashboards-variables-with-human-readable-keys/50645/1 "2025-03-10T20:05:44Z")

</div>

Looking at the latest dashboards, I can see we can define dashboard variables, however I haven’t found how to define variables as map where the key is a human readable string and the value is the actual value we want to use as the variable value.

For example, we want to have a variable in the dashboard that displays host name (human readable) but actually references the host.id which is the value we want to use.

Having a bunch of id’s in a variable usually don’t mean anything to people using dashboards since they they only know they host by their friendly name.

Is there a way to do that? Thanks.

---

<div class="post-metadata">

**Author:** ![marco\_irmer](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/marco_irmer/32/3038_2.png) [@marco\_irmer](https://community.dynatrace.com/u/marco_irmer)\
**Post date:** [March 10, 2025, 8:16pm UTC](https://community.dynatrace.com/t/is-there-a-way-to-define-dashboards-variables-with-human-readable-keys/50645/2 "2025-03-10T20:16:48Z")

</div>

I am not sure if this would meet your needs, but one method we use to accomplish this is to write DQL queries that incorporate the human readable entity name into the results, and then filter based on that. There’s a handy function, [entityName()](https://docs.dynatrace.com/docs/discover-dynatrace/references/dynatrace-query-language/functions/general-functions#entity-name), that can be used to add a field containing the human readable entity name.

Example (using a variable named ‘hostVar’)

```cpp
timeseries avg(dt.host.cpu.usage), by: { dt.entity.host }
| fieldsAdd dt.entity.host.name = entityName(dt.entity.host)
| filter dt.entity.host.name == $hostVar // filter here based on variable value

```

---

<div class="post-metadata">

**Author:** ![strudeau](https://avatars.discourse-cdn.com/v4/letter/s/6a8cbe/32.png) [@strudeau](https://community.dynatrace.com/u/strudeau)\
**Post date:** [March 10, 2025, 8:47pm UTC](https://community.dynatrace.com/t/is-there-a-way-to-define-dashboards-variables-with-human-readable-keys/50645/3 "2025-03-10T20:47:36Z")

</div>

Ok, so what you are proposing is to actually define 2 variables, one shown (with friendly name) and one hidden with the values. The one with the values uses the friendly name to make a lookup. I will try it out. Thanks.

---

<div class="post-metadata">

**Author:** ![marco\_irmer](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/marco_irmer/32/3038_2.png) [@marco\_irmer](https://community.dynatrace.com/u/marco_irmer)\
**Post date:** [March 10, 2025, 9:24pm UTC](https://community.dynatrace.com/t/is-there-a-way-to-define-dashboards-variables-with-human-readable-keys/50645/4 "2025-03-10T21:24:10Z")

</div>

Not quite. You could have one variable that just deals with human readable values, but then handle the translation between human readable and internal ID within the DQL of your tiles. I have attached a sample dashboard that you can import (you’ll have to change the extension to .json before importing). In this dashboard, we have a variable that is defined by the following query:

```csharp
fetch dt.entity.host
| fields hostName=entityName(id, type:"dt.entity.host")
| limit 20 // limit for demo purposes only

```

The variable only holds human-readable elements, the host name in this case. When a user selects a host name from the dropdown, the variable works together with the query I shared in the original reply to display the CPU utilization just for specified server.  
[Friendly Variable Demo.json.txt](https://community.dynatrace.com/uploads/short-url/j1uzebkLr5kUuG8Ej9CBaclf8mC.txt) (6.74 KB)

---

<div class="post-metadata">

**Author:** ![ANLTH](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@ANLTH](https://community.dynatrace.com/u/ANLTH)\
**Post date:** [March 31, 2025, 7:53am UTC](https://community.dynatrace.com/t/is-there-a-way-to-define-dashboards-variables-with-human-readable-keys/50645/5 "2025-03-31T07:53:00Z")

</div>

Hi

I could really do with this option as well. In my case i would use CSV, so if I had the option to give the value a “display name” that the user select on the dashboard, but the underlying query use the value as input.

Regards,

Anne-Lis
