# Join DQL fields

**URL:** <https://community.dynatrace.com/t/join-dql-fields/51926>\
**Category:** DQL\
**Tags:** dql, notebooks\
**Created:** [June 3, 2025, 3:06pm UTC](https://community.dynatrace.com/t/join-dql-fields/51926 "2025-06-03T15:06:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pablo2](https://avatars.discourse-cdn.com/v4/letter/p/ac91a4/32.png) [@Pablo2](https://community.dynatrace.com/u/Pablo2)\
**Post date:** [June 3, 2025, 3:06pm UTC](https://community.dynatrace.com/t/join-dql-fields/51926/1 "2025-06-03T15:06:15Z")

</div>

I have the following DQL with which I get information about the hosts and the activity of their services.

timeseries avg(dt.osservice.availability)  
by: { host.name, dt.osservice.status, dt.osservice.startup\_type, dt.osservice.name}  
filter: { NOT matchesValue(dt.osservice.status, { “active”, “running” }) }

I want to get out what OS the host listed in my DQL has.

I’ve tried something like this but it doesn’t match it, any solution?

timeseries avg(dt.osservice.availability)  
by: { host.name, dt.osservice.status, dt.osservice.startup\_type, dt.osservice.name, osType}  
filter: { NOT matchesValue(dt.osservice.status, { “active”, “running” }) }  
| expand host.name  
| lookup [fetch dt.entity.host], sourceField:host.name, lookupField:osType

---

<div class="post-metadata">

**Author:** ![StrangerThing](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/strangerthing/32/12182_2.png) [@StrangerThing](https://community.dynatrace.com/u/StrangerThing)\
**Post date:** [June 3, 2025, 4:42pm UTC](https://community.dynatrace.com/t/join-dql-fields/51926/2 "2025-06-03T16:42:32Z")

</div>

Try this:

```markup
timeseries avg(dt.osservice.availability),
  by: { host.name, dt.osservice.status, dt.osservice.startup_type, dt.osservice.name, osType},
  filter: { NOT in(dt.osservice.status, array("active", "running")) }
| expand host.name
| lookup [fetch dt.entity.host], sourceField:host.name, lookupField:entity.name, fields:{osType}

```

---

<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:** [June 3, 2025, 10:09pm UTC](https://community.dynatrace.com/t/join-dql-fields/51926/3 "2025-06-03T22:09:04Z")

</div>

Another way to accomplish this would be to add the dt.entity.host dimension to the timeseries query, and then use the entityAttr() function to retrieve the osType field value.

The query looks like this:

```javascript
timeseries avg(dt.osservice.availability),
  by: { dt.entity.host, host.name, dt.osservice.status, dt.osservice.startup_type, dt.osservice.name, osType},
  filter: { NOT in(dt.osservice.status, array("active", "running")) }
| fieldsAdd entityAttr(dt.entity.host,"osType")

```
