# Combining two entity types in a single Data Explorer query

**URL:** <https://community.dynatrace.com/t/combining-two-entity-types-in-a-single-data-explorer-query/40152>\
**Category:** Dashboarding\
**Tags:** dynatrace-managed, data-explorer\
**Created:** [June 9, 2023, 3:37pm UTC](https://community.dynatrace.com/t/combining-two-entity-types-in-a-single-data-explorer-query/40152 "2023-06-09T15:37:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulito](https://avatars.discourse-cdn.com/v4/letter/p/e19adc/32.png) [@paulito](https://community.dynatrace.com/u/paulito)\
**Post date:** [June 9, 2023, 3:37pm UTC](https://community.dynatrace.com/t/combining-two-entity-types-in-a-single-data-explorer-query/40152/1 "2023-06-09T15:37:25Z")

</div>

I have a single metric but there are two different entity types I’d like to include: hosts and custom devices.

Custom devices:

```markup
nagios._Check_CPU_Stats.iowait.percent:filter(and(or(in("dt.entity.custom_device",entitySelector("type(custom_device),entityName.equals(~"blah1~")")),in("dt.entity.custom_device",entitySelector("type(custom_device),entityName.equals(~"blah2~")"))))):splitBy("dt.entity.custom_device"):sort(value(auto,descending)):limit(20)

```

Hosts:

```markup
nagios._Check_CPU_Stats.iowait.percent:filter(and(or(in("dt.entity.host",entitySelector("type(host),entityName.equals(~"blah3~")")),in("dt.entity.host",entitySelector("type(host),entityName.equals(~"blah4~")")),in("dt.entity.host",entitySelector("type(host),entityName.equals(~"blha5~")")),in("dt.entity.host",entitySelector("type(host),entityName.equals(~"blah6~")"))))):splitBy("dt.entity.host"):sort(value(auto,descending)):limit(20)

```

Both queries are for io waittime and it works well on a graph:

 ![paulito_0-1686324661750.png](https://global.discourse-cdn.com/dynatrace/original/3X/c/e/cee8225d273e565f6cbbf21342fd957db9abda2f.png)

But when I change from graph to single value I have to pick one query or the other.

Is there a way to combine the two in a single query?

---

<div class="post-metadata">

**Author:** ![Mohamed\_Hamdy](https://avatars.discourse-cdn.com/v4/letter/m/7ab992/32.png) [@Mohamed\_Hamdy](https://community.dynatrace.com/u/Mohamed_Hamdy)\
**Post date:** [June 14, 2023, 11:06pm UTC](https://community.dynatrace.com/t/combining-two-entity-types-in-a-single-data-explorer-query/40152/2 "2023-06-14T23:06:31Z")

</div>

Hi&nbsp;[@paulito](https://community.dynatrace.com/user/56467),

to be honest, I’m not sure if the following sample query will work or not, but you can give it a try for the single value and let me know,

nagios.\_Check\_CPU\_Stats.iowait.percent:filter(and(or(in(“dt.entity.custom\_device”,entitySelector(“type(custom\_device),entityName.equals(~“blah1~”)”)),in(“dt.entity.custom\_device”,entitySelector(“type(custom\_device),entityName.equals(~“blah2~”)”)),in(“dt.entity.host”,entitySelector(“type(host),entityName.equals(~“blah3~”)”)),in(“dt.entity.host”,entitySelector(“type(host),entityName.equals(~“blah4~”)”)),in(“dt.entity.host”,entitySelector(“type(host),entityName.equals(~“blha5~”)”)),in(“dt.entity.host”,entitySelector(“type(host),entityName.equals(~“blah6~”)”))))):limit(20)
