# Close problem only when {dims:units} is 0

**URL:** <https://community.dynatrace.com/t/close-problem-only-when-dims-units-is-0/54101>\
**Category:** Alerting\
**Tags:** problem-detection, problem-notification, anomaly-detection, problems\
**Created:** [November 17, 2025, 7:00am UTC](https://community.dynatrace.com/t/close-problem-only-when-dims-units-is-0/54101 "2025-11-17T07:00:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![O11y\_Noob](https://avatars.discourse-cdn.com/v4/letter/o/9fc348/32.png) [@O11y\_Noob](https://community.dynatrace.com/u/O11y_Noob)\
**Post date:** [November 17, 2025, 7:00am UTC](https://community.dynatrace.com/t/close-problem-only-when-dims-units-is-0/54101/1 "2025-11-17T07:00:37Z")

</div>

```auto
timeseries v = avg(unexpecteddowntime), by: {site, unit}
| summarize {
site_series = avg(v[]), 
units = collectDistinct(unit) 
}, by: {site, timeframe, interval} 
| filter arrayMax(site_series) > 30 
| fieldsAdd units_str = toString(units)

```

Using this in Davis Anomaly Detector for creating alerts site wise, and having {dims:units} in the description but the problem is closing and opening a new instance whenever there is change in the {dims:units}. I only want to close the alert {dims:units} is 0

---

<div class="post-metadata">

**Author:** ![t\_pawlak](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/t_pawlak/32/14991_2.png) [@t\_pawlak](https://community.dynatrace.com/u/t_pawlak)\
**Post date:** [November 17, 2025, 10:01am UTC](https://community.dynatrace.com/t/close-problem-only-when-dims-units-is-0/54101/2 "2025-11-17T10:01:17Z")

</div>

Hi,  
If you are using this query, and in the Davis Anomaly metric event you’re using something like {dims:units} in the description. In Dynatrace, whenever a dimension (anything referenced via {dims:…}) changes, Davis treats it as a new problem instance.  
So when the list of units changes even slightly: Old problem is closed and&nbsp;New problem is opened

That’s why you see constant open/close cycles.

If I correctly understand, you want to open one problem per site.

So, do not use {dims:units} anywhere (especially in description).  
That makes units part of the problem key.

Use units only as a field, not a dimension.

Drive open/close behaviour via DQL:

- Alert only when units\_count \> 0
- Problem auto-closes when units\_count = 0

Try this:

```markup
timeseries v = avg(unexpecteddowntime), by: {site, unit}
| summarize {
    site_series = avg(v[]),
    units = collectDistinct(unit),
    units_count = countDistinct(unit)
  }, by: {site, timeframe, interval}
| filter arrayMax(site_series) > 30
| filter units_count > 0
| fieldsAdd units_str = toString(units)

```

units\_count \> 0 → only then the metric event is evaluated as violating

When units\_count becomes 0, the violation stops → Davis will close the problem

Then in metric event use site as a dimension, like this:

```markup
Site: {dims:site}
Affected units: {fields.units_str}

```

---

<div class="post-metadata">

**Author:** ![O11y\_Noob](https://avatars.discourse-cdn.com/v4/letter/o/9fc348/32.png) [@O11y\_Noob](https://community.dynatrace.com/u/O11y_Noob)\
**Post date:** [November 17, 2025, 11:11am UTC](https://community.dynatrace.com/t/close-problem-only-when-dims-units-is-0/54101/3 "2025-11-17T11:11:19Z")

</div>

![O11y_Noob_0-1763377776018.png](https://global.discourse-cdn.com/dynatrace/original/3X/0/e/0e3723b926c7b8167eaf16eaf6711fe422526c44.png)

the filter that you see in the problem is not part of my query but its getting added and the reffered fields.unit\_Str is not getting the field value referred , could you pls help here&nbsp;[@t\_pawlak](https://community.dynatrace.com/user/42367)

---

<div class="post-metadata">

**Author:** ![patryk\_ozimek2](https://avatars.discourse-cdn.com/v4/letter/p/bbce88/32.png) [@patryk\_ozimek2](https://community.dynatrace.com/u/patryk_ozimek2)\
**Post date:** [November 18, 2025, 6:37am UTC](https://community.dynatrace.com/t/close-problem-only-when-dims-units-is-0/54101/4 "2025-11-18T06:37:38Z")

</div>

Hi,

I don’t see such thing as “fields” in the doc ([Anomaly detection configuration — Dynatrace Docs](https://docs.dynatrace.com/docs/shortlink/anomaly-detection-configuration#event-template)) - I also tried to use it in my Davis Anomaly Detector but results were the same like for&nbsp;[@O11y\_Noob](https://community.dynatrace.com/user/85826)

Can you please give the source from which you got this info?

Best Regards,  
Patryk

---

<div class="post-metadata">

**Author:** ![t\_pawlak](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/t_pawlak/32/14991_2.png) [@t\_pawlak](https://community.dynatrace.com/u/t_pawlak)\
**Post date:** [November 18, 2025, 8:28am UTC](https://community.dynatrace.com/t/close-problem-only-when-dims-units-is-0/54101/5 "2025-11-18T08:28:16Z")

</div>

Hi,  
It looks like the additional filter (…) you see in the problem view is not coming from your DQL. Davis automatically adds a filter for the concrete time-series that triggered the event (based on the dimensions/placeholders used in the metric event).

Also, my previous suggestion with {fields.units\_str} was misleading – fields.\* placeholders are not supported in the event template, which is why you don’t see the value there.

In practice this means that if you reference units / units\_str in the title/description, Davis will “pin” the problem to that exact value and will open/close a new problem every time the list of units changes. To have one problem per site, keep units only inside DQL (for filtering/logic) and use only {dims:site} (and standard placeholders like {value}) in the event template.

---

<div class="post-metadata">

**Author:** ![O11y\_Noob](https://avatars.discourse-cdn.com/v4/letter/o/9fc348/32.png) [@O11y\_Noob](https://community.dynatrace.com/u/O11y_Noob)\
**Post date:** [November 18, 2025, 9:56am UTC](https://community.dynatrace.com/t/close-problem-only-when-dims-units-is-0/54101/6 "2025-11-18T09:56:40Z")

</div>

the team wants to see the unit names in the problem ticket , how can i include it in the problem ?
