# Build a variable for the new Dashboard

**URL:** <https://community.dynatrace.com/t/build-a-variable-for-the-new-dashboard/52134>\
**Category:** Dashboarding\
**Tags:** dashboards\
**Created:** [June 17, 2025, 12:10pm UTC](https://community.dynatrace.com/t/build-a-variable-for-the-new-dashboard/52134 "2025-06-17T12:10:09Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChadTurner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chadturner/32/161_2.png) [@ChadTurner](https://community.dynatrace.com/u/ChadTurner)\
**Post date:** [June 17, 2025, 12:10pm UTC](https://community.dynatrace.com/t/build-a-variable-for-the-new-dashboard/52134/1 "2025-06-17T12:10:09Z")

</div>

I’m hitting a wall… My overall goal is to build a variable for our new dashboard that looks at the “dataCenterName”. This way users can use a dashboard that has core metrics such as CPU, Disk, Memory, etc… and reformulate the data by selecting the desired DC’s.

Any help would be appreciated!

 ![ChadTurner_0-1750162194799.png](https://global.discourse-cdn.com/dynatrace/original/1X/13107158d0957bceff297176d80b03cda4eb4f62.png)

---

<div class="post-metadata">

**Author:** ![lubrman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/lubrman/32/7353_2.png) [@lubrman](https://community.dynatrace.com/u/lubrman)\
**Post date:** [June 17, 2025, 12:21pm UTC](https://community.dynatrace.com/t/build-a-variable-for-the-new-dashboard/52134/2 "2025-06-17T12:21:05Z")

</div>

Hi&nbsp;[@ChadTurner](https://community.dynatrace.com/user/14877)

One possible approach for you could be to separate data centers using tagging and then include them in Management Zones (MZ). You could set up an auto-tagging rule to tag hosts based on their data center. If you’re able to divide hosts into host groups, you can then define the segmentation based on those groups.

---

<div class="post-metadata">

**Author:** ![ChadTurner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chadturner/32/161_2.png) [@ChadTurner](https://community.dynatrace.com/u/ChadTurner)\
**Post date:** [June 17, 2025, 12:30pm UTC](https://community.dynatrace.com/t/build-a-variable-for-the-new-dashboard/52134/3 "2025-06-17T12:30:13Z")

</div>

yeah, that is a viable solution form Gen1 and Gen2 of Dynatrace UI. Ideally I’d like to get it all linked in a Gen3 Dashboard, that way we can leverage some of the newer capabilities.

[@Fin\_Ubels](https://community.dynatrace.com/user/47376)&nbsp;- Do you have any recommendations on Setting the DC Name as a variable for host metrics on a new Dashboard?

---

<div class="post-metadata">

**Author:** ![Kenny\_Gillette](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/kenny_gillette/32/20170_2.png) [@Kenny\_Gillette](https://community.dynatrace.com/u/Kenny_Gillette)\
**Post date:** [June 17, 2025, 12:39pm UTC](https://community.dynatrace.com/t/build-a-variable-for-the-new-dashboard/52134/4 "2025-06-17T12:39:21Z")

</div>

I see the dilemma.&nbsp; There is no auto tag for DCs unfortunetly.

[https://community.dynatrace.com/t5/Product-ideas/Using-data-center-as-an-auto-tag/idi-p/151331](https://community.dynatrace.com/post/151331)

Tried Segments?

 ![Kenny_Gillette_1-1750164008355.png](https://global.discourse-cdn.com/dynatrace/original/3X/f/6/f62122b23942b5b968da3e89de03297e051ac687.png)

---

<div class="post-metadata">

**Author:** ![ChadTurner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chadturner/32/161_2.png) [@ChadTurner](https://community.dynatrace.com/u/ChadTurner)\
**Post date:** [June 17, 2025, 12:47pm UTC](https://community.dynatrace.com/t/build-a-variable-for-the-new-dashboard/52134/5 "2025-06-17T12:47:15Z")

</div>

that’s the thing, If I can do segments, one would think I could do Variables and thus cut down a bunch of segments. If push comes to shove then I’ll go the segment route.

---

<div class="post-metadata">

**Author:** ![Kenny\_Gillette](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/kenny_gillette/32/20170_2.png) [@Kenny\_Gillette](https://community.dynatrace.com/u/Kenny_Gillette)\
**Post date:** [June 17, 2025, 2:19pm UTC](https://community.dynatrace.com/t/build-a-variable-for-the-new-dashboard/52134/6 "2025-06-17T14:19:45Z")

</div>

Other ideas:

Create a DataCenter tag:1.) DC IPs hopefully are different so tag based off IP2.) Server name - do each host have part of the DC in its name?

---

<div class="post-metadata">

**Author:** ![ChadTurner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chadturner/32/161_2.png) [@ChadTurner](https://community.dynatrace.com/u/ChadTurner)\
**Post date:** [June 17, 2025, 2:35pm UTC](https://community.dynatrace.com/t/build-a-variable-for-the-new-dashboard/52134/7 "2025-06-17T14:35:54Z")

</div>

So I’ve pivoted - Using Variables within segments to drastically cut down the number of defined segments needed. Which also cuts down the pain of altering already built tiles.

I’ll keep you guys informed as I go along. Once I get everything all set, I will have a PRO TIP coming out too 🙂

---

<div class="post-metadata">

**Author:** ![Kenny\_Gillette](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/kenny_gillette/32/20170_2.png) [@Kenny\_Gillette](https://community.dynatrace.com/u/Kenny_Gillette)\
**Post date:** [June 17, 2025, 2:51pm UTC](https://community.dynatrace.com/t/build-a-variable-for-the-new-dashboard/52134/8 "2025-06-17T14:51:10Z")

</div>

We love pro tips.

---

<div class="post-metadata">

**Author:** ![christian\_k](https://avatars.discourse-cdn.com/v4/letter/c/9f8e36/32.png) [@christian\_k](https://community.dynatrace.com/u/christian_k)\
**Post date:** [June 17, 2025, 6:02pm UTC](https://community.dynatrace.com/t/build-a-variable-for-the-new-dashboard/52134/9 "2025-06-17T18:02:38Z")

</div>

That is exactly the “pro” way we envisioned using variables and Segments combined. Future improvements will support this journey.

Feel free to share feedback or ping me in case you need help identifying the best way to set up and apply your data segmentation and filtering.

---

<div class="post-metadata">

**Author:** ![mgome](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@mgome](https://community.dynatrace.com/u/mgome)\
**Post date:** [June 17, 2025, 7:13pm UTC](https://community.dynatrace.com/t/build-a-variable-for-the-new-dashboard/52134/10 "2025-06-17T19:13:20Z")

</div>

First create a variable with the following DQL:

```markup
fetch dt.entity.vmware_datacenter
| fieldsRemove id

```

Then you can use the variable in a timeseries query like this:

```python
timeseries cpuUsage=avg(dt.host.cpu.usage), by: { dt.entity.host },filter:in(dt.entity.host, classicEntitySelector(concat("type(HOST),toRelationships.isSiteOf(type(VMWARE_DATACENTER),entityName.equals(",toString($Datacenter),"))")))
| fieldsAdd entityName(dt.entity.host)

```

You have to use concat so you can turn the variable into a usable string with the toString call.

---

<div class="post-metadata">

**Author:** ![ChadTurner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chadturner/32/161_2.png) [@ChadTurner](https://community.dynatrace.com/u/ChadTurner)\
**Post date:** [June 18, 2025, 1:33pm UTC](https://community.dynatrace.com/t/build-a-variable-for-the-new-dashboard/52134/11 "2025-06-18T13:33:23Z")

</div>

Everyone, thank you or the information. I got variables to work on the dashboard. Now I’m looking to build a segment with variables along the same methodology.&nbsp;  
I’ve got the segment all defined out and working as validated in the InfraOps App, however its not applying to DQL or Metrics on the given dashboard. I suspect there needs to be further configuration at the DQL level? I would have assumed that it would have applied to the out of the box metrics however.

Notice there is data without Segments set:

 ![ChadTurner_5-1750253657515.png](https://global.discourse-cdn.com/dynatrace/original/3X/0/f/0f4adeb01758a874a3209177d4fd7deb88742dea.jpeg)

Then as we select the Segment with a variable, the data drops out. Yes, this is looking at VMware Host CPU and the selected segment is indeed VMware and I can validate it here as well:

 ![ChadTurner_2-1750253223827.png](https://global.discourse-cdn.com/dynatrace/original/3X/0/8/089135337dc110b79f0958870fd1ea85ec7314cf.png)

It’s working on the InfraOps app:

 ![ChadTurner_3-1750253324979.png](https://global.discourse-cdn.com/dynatrace/original/3X/6/3/63b6fa267b62c21bea049f1c440eef114da99348.png)

But as I then set the Segment variable as A\*\*\*\*1 you’ll see the tiles looking at both a DQL statement and an out of the box metric, fails to render:

 ![ChadTurner_4-1750253495658.png](https://global.discourse-cdn.com/dynatrace/original/2X/2/2012811b4b8f93fb01e257f769343e72d58316f0.jpeg)

I thought maybe there is just a processing delay much like we have seen with the legacy MZ’s where we can see the preview but it takes time for it to apply in the environment… but even an hour later, no dice. But also to that delay point, if there was a delay, then the InfraOps App wouldn’t have been able to use the Segment.

Any insight would be welcomed 🙂

---

<div class="post-metadata">

**Author:** ![ChadTurner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chadturner/32/161_2.png) [@ChadTurner](https://community.dynatrace.com/u/ChadTurner)\
**Post date:** [June 18, 2025, 1:42pm UTC](https://community.dynatrace.com/t/build-a-variable-for-the-new-dashboard/52134/12 "2025-06-18T13:42:04Z")

</div>

Thank you&nbsp;[@mgome](https://community.dynatrace.com/user/8132)&nbsp;that worked for setting a variable in the dashboard directly. We did expand the fetch to include all DataCenter Flavors like Geo Site, Vmware, GCP, Azure, AWS.

The only draw back is depending on what you select, certain tile might fail to render as it is a GCP tile but your DC selected is Azure… but that’s an understandable limitation/function as by way of the design.

---

<div class="post-metadata">

**Author:** ![Fin\_Ubels](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/fin_ubels/32/18008_2.png) [@Fin\_Ubels](https://community.dynatrace.com/u/Fin_Ubels)\
**Post date:** [June 19, 2025, 11:16pm UTC](https://community.dynatrace.com/t/build-a-variable-for-the-new-dashboard/52134/13 "2025-06-19T23:16:39Z")

</div>

Ah I think I ran into a similar problem a few weeks ago.

The first thing to note is the way management zones filter and the way segments filter is fundamentally different. Management zones allow filtering of all data types by entities whereas segments filter on records specified in the segment definition.

So when you create a segment it only filters on the data types specified in the segment. From what I see in your screenshot, we’re only filtering on entities and don’t have a section in the segment specifying how to filter on metrics.

The reason why this works in the infra/ops app is the base query for all of the tiles is “fetch dt.entity.host”. You can see this if you look at the network tab and refresh the page and then filter requests for “query”. With that, you can see all of the queries that make up any new platform pages. Unrelated to this, I find it very useful for learning how apps achieved specific views to help replicate them on a dashboard or notebook.

 ![Fin_Ubels_0-1750371905213.png](https://global.discourse-cdn.com/dynatrace/original/2X/b/b1cf7bfdd2a33538b737fa8c1b218d20ec43574e.png)

So, to fix the segment we need to add a metric section to the segment that tells the segment how to filter the metric OR we need to change the queries on the dashboard to start by fetching the host, just like in the infra/ops app.

If we wanted to add that metric section to a segment AND use the segment to filter by different types of cloud regions then we could combine the variable query something like this.

 ![Fin_Ubels_2-1750374044258.png](https://global.discourse-cdn.com/dynatrace/original/2X/5/55d17db5b3539d203d3b63d0d868e9b0fb865703.png)

Then when we go to use the variable in our segment definitions it would look something like this.

 ![Fin_Ubels_3-1750374091051.png](https://global.discourse-cdn.com/dynatrace/original/2X/3/390fe732ab03b5567a4ee5624d4c1882aa995ddc.png)

The last thing is actually using the segment and how that looks. If we query the dt.host.cpu.usage metric and split by our regions, we can see that I have it filtered on just the region I wanted. And thanks to the pretty name I can identify which region I’m filtering for while using the technical fields behind the scenes.

 ![Fin_Ubels_4-1750374327231.png](https://global.discourse-cdn.com/dynatrace/original/3X/5/1/51cbb713a96ff0580192ed3d7811a4e1a41c995f.png)

As we can see though, this doesn’t work for the host query.

 ![Fin_Ubels_6-1750374608239.png](https://global.discourse-cdn.com/dynatrace/original/3X/1/b/1bd7e7a303655a58bd0d412d2792f3046246e107.png)

So now lets make it work with the host query. First we would add our region entities and then add the host relationship for each.

 ![Fin_Ubels_5-1750374534559.png](https://global.discourse-cdn.com/dynatrace/original/3X/7/9/79d67414eb305f74e8237cd4bdc8d05b5657dec2.png)

Now when we rerun that host query it starts working because we’ve directly addressed how to filter for that record type with our segment.

 ![Fin_Ubels_7-1750374730704.png](https://global.discourse-cdn.com/dynatrace/original/3X/3/0/30ecdc9dd1a84f94310a7053c5e930f299f0ede5.png)

Hopefully this gets you on the right track with how segments work and how to make use of them in your case. Last time I was configuring them there was a limit to 20 configurations in a single segment so it may be difficult to make a generic “data center” segment that applies everywhere it can. If you make one for each Azure, AWS, VMWare and GCP then you’d be able to cover more use cases, but you’d also have 4 separate segments.

---

<div class="post-metadata">

**Author:** ![ChadTurner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chadturner/32/161_2.png) [@ChadTurner](https://community.dynatrace.com/u/ChadTurner)\
**Post date:** [June 20, 2025, 1:43pm UTC](https://community.dynatrace.com/t/build-a-variable-for-the-new-dashboard/52134/14 "2025-06-20T13:43:23Z")

</div>

Thank you&nbsp;[@Fin\_Ubels](https://community.dynatrace.com/user/47376)! Ill be sure to start working through all of this. It makes perfect sense the way you put it. It’s an all new way of thinking from Management Zones to Segments and I have to get my head wrapped around it fully and you’ve set me off on a great start.

---

<div class="post-metadata">

**Author:** ![Fin\_Ubels](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/fin_ubels/32/18008_2.png) [@Fin\_Ubels](https://community.dynatrace.com/u/Fin_Ubels)\
**Post date:** [August 20, 2025, 1:14am UTC](https://community.dynatrace.com/t/build-a-variable-for-the-new-dashboard/52134/15 "2025-08-20T01:14:04Z")

</div>

Hey Chad, just wanted to see how you ended up going with segments and what you managed to implement? Did you end up resolving the problem and making something cool or are there still some things holding you back?

---

<div class="post-metadata">

**Author:** ![ChadTurner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chadturner/32/161_2.png) [@ChadTurner](https://community.dynatrace.com/u/ChadTurner)\
**Post date:** [August 20, 2025, 11:15am UTC](https://community.dynatrace.com/t/build-a-variable-for-the-new-dashboard/52134/16 "2025-08-20T11:15:32Z")

</div>

Hey&nbsp;[@Fin\_Ubels](https://community.dynatrace.com/user/47376)&nbsp;thanks for following up. I got sidelined with some other urgent things so I had to put this on hold. But what I was able to do was build a dashboard that provided full forecasting in a capacity sense. Which would allow us to estimate what usage of our technology would look like if we doubled/tripled the load based off of new acquisitions etc. The Dashboard variable became problematic due to the issue you defined where there isnt a good way to slice it and have a one for all variable set. So I was working on building out the needed variables when I got sidelined for another task. My hope is that I can revisit the project soon. We were also looking at adding in the recommendations from the carbon app as it identified what needed to scale up/down. When you think about it, the carbon app is relative to capacity planning as it is monitoring the overall usage impact and providing recommendations to make the resource usage leaner.
