# How to refernce a $Variable if the returned output is a Table

**URL:** <https://community.dynatrace.com/t/how-to-refernce-a-variable-if-the-returned-output-is-a-table/55028>\
**Category:** Dashboarding\
**Tags:** dql, dashboards\
**Created:** [February 18, 2026, 5:25am UTC](https://community.dynatrace.com/t/how-to-refernce-a-variable-if-the-returned-output-is-a-table/55028 "2026-02-18T05:25:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlanFoley](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@AlanFoley](https://community.dynatrace.com/u/AlanFoley)\
**Post date:** [February 18, 2026, 5:25am UTC](https://community.dynatrace.com/t/how-to-refernce-a-variable-if-the-returned-output-is-a-table/55028/1 "2026-02-18T05:25:59Z")

</div>

Hi Guys

These are a couple of Visuals I have in an Availability Dashboard (refer to attached image)

Description of visuals referenced by numbers

1 – DQL query – Host availability per Application and Host - Visual = Table

2 – Same DQL query &nbsp;as in (1) with the addition of a summarize/ avg calculation (by Application)

| summarize {avg(Availability\_BH),avg(Availability\_NBH)}, by:{$Application}

3 – Hosts - Same DQL query &nbsp;as in (1) with the addition of a summarize / count (by Host)

| summarize Hosts = countDistinct(host.entity.name)

3 – Applications &nbsp;- Same DQL query &nbsp;as in (1) with the addition of a summarize / count&nbsp; (by Applications)

| summarize Applications = countDistinct(Application)

This scenario works fine but it is not efficient from a DQL query perspective as it needs to be run 5 times, once for the Detail (1) and then again for the remaining visuals(2,3) based on what&nbsp; summarization needs to take place depending on the Visual used

What I want to be able to do is perform the DQL query only once and then reference it in the other visual and then perform the required summarization

This could be possible by defining a hidden Variable called “HostDetail” and running the detail DQL query here which will contain the output in Table format as per (1) – I could then reference it and do the summarization

If the $HostDetail was JSON referencing it will be quite straightforward as it would be done as follows:

data json:$HostDetail

However because it is a Table I am not sure how to reference $HostDetail, I have referred to the DQL reference and &nbsp;tried a number of DQL functions but have been unsuccessful as I am not sure which function to use

Basically i am looking for this kind of syntax

data ???($HostDetail)

Is it possible? Looking for help with DQL syntax to use in this scenario

Why I want to get this working:

- A single DQL query to maintain
- Cost saving as the DQL query&nbsp; only needs to run once and then referenced in a $Variable based on summarization preference
- More efficient

Appreciate the assistance  
Thanks

Alan

 ![variable_relationships.png](https://global.discourse-cdn.com/dynatrace/original/3X/1/c/1c5c0be3f85dc2586bdac1a66c1b9bbc3c42d93f.png)

---

<div class="post-metadata">

**Author:** ![AlanFoley](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@AlanFoley](https://community.dynatrace.com/u/AlanFoley)\
**Post date:** [February 19, 2026, 9:33am UTC](https://community.dynatrace.com/t/how-to-refernce-a-variable-if-the-returned-output-is-a-table/55028/2 "2026-02-19T09:33:30Z")

</div>

Just an update

I have made some progress on this - what I do at the end of the DQL now is to convert the Table into a JSON array as follows:

| fieldsAdd&nbsp; row = record(Field1=Field1,Field2=Field2 ,Field3=Field3)| summarize all\_rows = collectArray(row)

The data is returned in JSON format (Validated by an online JSON validator) - see sample data below

However referencing the variable as follows does still not work  
data json:$HostDetail

I get this error msg so it does seem as if the format may not be seen as JSON but it is  
The command `data` parameter `json` value is invalid: the value needs to be a JSON object or JSON array of JSON objects. Please specify a valid parameter and try again.

Here is a sample of the returned JSON

[{“MonthId”:“202602”,“host.id”:“HOST-318A276BB0F116E1”,“host.entity.name”:“Server1”,“Cloud\_or\_OnPremises”:“Cloud”,“osArchitecture”:“X86”,“osType”:“WINDOWS”,“Hypervisor”:“HYPER\_V”,“Environment”:“QA”,“Hours\_BH”:“59”,“Availability\_BH”:98.44632768361582,“Availability\_BH\_w10”:9.844632768361583,“Hours\_NBH”:“79”,“Availability\_NBH”:95.61181434599156,“Availability\_NBH\_w5”:4.780590717299578,“HoursInMonth”:“138”,“Hours\_Check\_MustBeZero”:“0”,“Application”:“Application 1”},{“MonthId”:“202602”,“host.id”:“HOST-45D773ABF8B98F74”,“host.entity.name”:“Server2”,“Cloud\_or\_OnPremises”:“OnPremises”,“osArchitecture”:“X86”,“osType”:“WINDOWS”,“Hypervisor”:“VMWARE”,“Environment”:“PROD”,“Hours\_BH”:“61”,“Availability\_BH”:98.87978142076503,“Availability\_BH\_w10”:9.887978142076504,“Hours\_NBH”:“108”,“Availability\_NBH”:100,“Availability\_NBH\_w5”:5,“HoursInMonth”:“169”,“Hours\_Check\_MustBeZero”:“0”,“Application”:“Application 1”}]I would appreciate any insightsThanksAlan

---

<div class="post-metadata">

**Author:** ![AlanFoley](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@AlanFoley](https://community.dynatrace.com/u/AlanFoley)\
**Post date:** [February 19, 2026, 9:41am UTC](https://community.dynatrace.com/t/how-to-refernce-a-variable-if-the-returned-output-is-a-table/55028/3 "2026-02-19T09:41:05Z")

</div>

I forgot to add that i also tested in notebook as follows and data was returened sucessfully

data json:“”"  
[{“MonthId”:“202602”,“host.id”:“HOST-318A276BB0F116E1”,“host.entity.name”:“Server1”,“Cloud\_or\_OnPremises”:“Cloud”,“osArchitecture”:“X86”,“osType”:“WINDOWS”,“Hypervisor”:“HYPER\_V”,“Environment”:“QA”,“Hours\_BH”:“59”,“Availability\_BH”:98.44632768361582,“Availability\_BH\_w10”:9.844632768361583,“Hours\_NBH”:“79”,“Availability\_NBH”:95.61181434599156,“Availability\_NBH\_w5”:4.780590717299578,“HoursInMonth”:“138”,“Hours\_Check\_MustBeZero”:“0”,“Application”:“Application 1”},{“MonthId”:“202602”,“host.id”:“HOST-45D773ABF8B98F74”,“host.entity.name”:“Server2”,“Cloud\_or\_OnPremises”:“OnPremises”,“osArchitecture”:“X86”,“osType”:“WINDOWS”,“Hypervisor”:“VMWARE”,“Environment”:“PROD”,“Hours\_BH”:“61”,“Availability\_BH”:98.87978142076503,“Availability\_BH\_w10”:9.887978142076504,“Hours\_NBH”:“108”,“Availability\_NBH”:100,“Availability\_NBH\_w5”:5,“HoursInMonth”:“169”,“Hours\_Check\_MustBeZero”:“0”,“Application”:“Application 1”}]  
“”"

So looks more like an issue accessing the $Variable in Dashboards
