# Adding a filter in timeseries gives strange effect, is it a bug or is it a feature?

**URL:** <https://community.dynatrace.com/t/adding-a-filter-in-timeseries-gives-strange-effect-is-it-a-bug-or-is-it-a-feature/51950>\
**Category:** DQL\
**Tags:** dql, dynatrace-managed\
**Created:** [June 5, 2025, 6:22am UTC](https://community.dynatrace.com/t/adding-a-filter-in-timeseries-gives-strange-effect-is-it-a-bug-or-is-it-a-feature/51950 "2025-06-05T06:22:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![henk\_stobbe](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/henk_stobbe/32/30434_2.png) [@henk\_stobbe](https://community.dynatrace.com/u/henk_stobbe)\
**Post date:** [June 5, 2025, 6:22am UTC](https://community.dynatrace.com/t/adding-a-filter-in-timeseries-gives-strange-effect-is-it-a-bug-or-is-it-a-feature/51950/1 "2025-06-05T06:22:34Z")

</div>

Good morning,

Look at below example:

_timeseries {_  
&nbsp; &nbsp; &nbsp; &nbsp; _new = sum(dt.process.network.sessions.new),_  
&nbsp; &nbsp; &nbsp; &nbsp;_{reset = sum(dt.process.network.sessions.reset), filter: dt.entity.host==“HOST-XYX”},_  
&nbsp; &nbsp; &nbsp; &nbsp;_{timeout = sum(dt.process.network.sessions.timeout), default:0}_  
&nbsp; &nbsp; &nbsp; &nbsp;_},_  
&nbsp; &nbsp; &nbsp; &nbsp;_by:{dt.entity.host}_

==\> the filter gets places on new reset and timeout

In this example:

_timeseries {_  
&nbsp; &nbsp; &nbsp; &nbsp; _new = sum(dt.process.network.sessions.new),_  
&nbsp; &nbsp; &nbsp; &nbsp;_{reset = sum(dt.process.network.sessions.reset), filter: dt.entity.host==“HOST-XYX”},_  
&nbsp; &nbsp; &nbsp; &nbsp;_{timeout = sum(dt.process.network.sessions.timeout), filter: dt.entity.host==“HOST-ABC”}_  
&nbsp; &nbsp; &nbsp; &nbsp;_},_  
&nbsp; &nbsp; &nbsp; &nbsp;_by:{dt.entity.host}_

==\> the filters are “and” so you get no results

So is DQL right or wrong?

KR Henk

---

<div class="post-metadata">

**Author:** ![GerardJ](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/gerardj/32/154_2.png) [@GerardJ](https://community.dynatrace.com/u/GerardJ)\
**Post date:** [June 5, 2025, 7:00am UTC](https://community.dynatrace.com/t/adding-a-filter-in-timeseries-gives-strange-effect-is-it-a-bug-or-is-it-a-feature/51950/2 "2025-06-05T07:00:44Z")

</div>

Hi&nbsp;[@henk\_stobbe](https://community.dynatrace.com/user/11427)&nbsp;  
This could be caused by the default union parameter value when combining multiple timeseries :

 ![GerardJ_0-1749106729506.png](https://global.discourse-cdn.com/dynatrace/original/3X/6/7/679bbfc583e97207f2be191437a2fff6c1cce93f.png)

[DQL Metric commands — Dynatrace Docs](https://docs.dynatrace.com/docs/discover-dynatrace/references/dynatrace-query-language/commands/metric-commands)

---

<div class="post-metadata">

**Author:** ![krzysztof\_hoja](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/krzysztof_hoja/32/34625_2.png) [@krzysztof\_hoja](https://community.dynatrace.com/u/krzysztof_hoja)\
**Post date:** [June 5, 2025, 6:58pm UTC](https://community.dynatrace.com/t/adding-a-filter-in-timeseries-gives-strange-effect-is-it-a-bug-or-is-it-a-feature/51950/3 "2025-06-05T18:58:50Z")

</div>

The correct syntax looks like this and every thing works even if there is no common subset between data for 2 timeseries. Please use _ **filter:** _ clause inside regular brackets (not curly).

 ![krzysztof_hoja_1-1749149782598.png](https://global.discourse-cdn.com/dynatrace/original/3X/0/3/0320881b9932a83f257f21891daf629a216bac08.png)

re: second query. Syntax is incorrect. This query should not even execute:

 ![krzysztof_hoja_0-1749149660315.png](https://global.discourse-cdn.com/dynatrace/original/3X/5/e/5e162380a13ffd738641a0413577b380349f60b1.png)

---

<div class="post-metadata">

**Author:** ![henk\_stobbe](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/henk_stobbe/32/30434_2.png) [@henk\_stobbe](https://community.dynatrace.com/u/henk_stobbe)\
**Post date:** [June 5, 2025, 9:20pm UTC](https://community.dynatrace.com/t/adding-a-filter-in-timeseries-gives-strange-effect-is-it-a-bug-or-is-it-a-feature/51950/4 "2025-06-05T21:20:22Z")

</div>

Hello,

This is why I like the community so much (-;

As a remark, you really need to drop the BY:

An you can now use things like:

| fieldsAdd x = arrayAvg(r1) - arrayAvg(r2)  
&nbsp; &nbsp; &nbsp; &nbsp; | fieldsKeep x

This is what my customer liked to see. Thanks!

KR Henk

---

<div class="post-metadata">

**Author:** ![henk\_stobbe](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/henk_stobbe/32/30434_2.png) [@henk\_stobbe](https://community.dynatrace.com/u/henk_stobbe)\
**Post date:** [June 6, 2025, 8:06am UTC](https://community.dynatrace.com/t/adding-a-filter-in-timeseries-gives-strange-effect-is-it-a-bug-or-is-it-a-feature/51950/5 "2025-06-06T08:06:19Z")

</div>

one more addon, if you want to keep timeseries:

| fieldsAdd x = timeout[] + new[]  
| fieldsKeep timeframe,interval,x

Have fun!
