# Using the AND Operator For Multiple Filter Conditions

**URL:** <https://community.dynatrace.com/t/using-the-and-operator-for-multiple-filter-conditions/41963>\
**Category:** Dashboarding\
**Tags:** dynatrace-managed, data-explorer\
**Created:** [October 6, 2023, 3:53pm UTC](https://community.dynatrace.com/t/using-the-and-operator-for-multiple-filter-conditions/41963 "2023-10-06T15:53:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![victor\_correa](https://avatars.discourse-cdn.com/v4/letter/v/90ced4/32.png) [@victor\_correa](https://community.dynatrace.com/u/victor_correa)\
**Post date:** [October 6, 2023, 3:53pm UTC](https://community.dynatrace.com/t/using-the-and-operator-for-multiple-filter-conditions/41963/1 "2023-10-06T15:53:12Z")

</div>

I need to run a query with 3 conditions for the “:filter” command, and I am having a hard time with the syntax.

This is the base query that I am working off of:

_ **1** &nbsp; &nbsp;&nbsp;builtin:tech.generic.mem.workingSetSize_  
_ **2** &nbsp; &nbsp;&nbsp;:filter(in(“dt.entity.process\_group\_instance”,entitySelector(“type(process\_group\_instance),entityName(~“Oracle Database~”)”)))_  
_ **3** &nbsp; &nbsp;&nbsp;:parents:splitBy(“dt.entity.host”):avg:sort(value(avg,descending))_  
_ **4** &nbsp; &nbsp;&nbsp;:filter(in(“dt.entity.host”, entitySelector(“type(~“HOST~”),tag(~“TYPE:Oracle Database Server~”)”)))_

It returns all results without any issues, but I need to add another condition for filtering. I have built the condition separately and I have tried to add the line below, to no avail:

_ **5** &nbsp; &nbsp;&nbsp;:filter(in(“dt.entity.host”, entitySelector(“type(~“HOST~”),tag(~“Capability:Global Money Transfer~”)”)))_

I am assuming that there might be a conflict between the multiple “:filter” instances and the way around would be using the AND operator, but I am struggling so hard with the syntax that I was hoping to get a little guidance from the community.

---

<div class="post-metadata">

**Author:** ![victor\_balbuena](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/victor_balbuena/32/9773_2.png) [@victor\_balbuena](https://community.dynatrace.com/u/victor_balbuena)\
**Post date:** [October 6, 2023, 4:10pm UTC](https://community.dynatrace.com/t/using-the-and-operator-for-multiple-filter-conditions/41963/2 "2023-10-06T16:10:48Z")

</div>

If you need a host to have both the tags&nbsp; **TYPE:Oracle Database Server** and&nbsp; **Capability:Global Money Transfer** , then you can merge your filters in step 4 and 5 with an and as you suggest in the following way:

_:filter(and(in(“dt.entity.host”, entitySelector(“type(~“HOST~”),tag(~“TYPE:Oracle Database Server~”)”)),in(“dt.entity.host”, entitySelector(“type(~“HOST~”),tag(~“Capability:Global Money Transfer~”)”))))_

_If you need hosts that have&nbsp; **any** of the tags, then you can just do:_

_:filter(in(“dt.entity.host”, entitySelector(“type(~“HOST~”),tag(~“TYPE:Oracle Database Server~”,~“Capability:Global Money Transfer~”)”)))_

_Hopefully this helps._

---

<div class="post-metadata">

**Author:** ![victor\_correa](https://avatars.discourse-cdn.com/v4/letter/v/90ced4/32.png) [@victor\_correa](https://community.dynatrace.com/u/victor_correa)\
**Post date:** [October 6, 2023, 6:56pm UTC](https://community.dynatrace.com/t/using-the-and-operator-for-multiple-filter-conditions/41963/3 "2023-10-06T18:56:50Z")

</div>

Hey Victor,

Thanks for replying. I guess the Victors stay together. LoL

I have tried the query with the AND operator, but for some reason, it doesn’t return any data. I ended up using Dynamic Filters for the Capability, since the value would be universal for all tiles in the Dashboard, so I don’t need the filter in the query themselves.

But I appreciate you taking the time to help out.
