# how to display the number of problems and trends?

**URL:** <https://community.dynatrace.com/t/how-to-display-the-number-of-problems-and-trends/48092>\
**Category:** DQL\
**Tags:** dql, problems\
**Created:** [October 2, 2024, 12:52pm UTC](https://community.dynatrace.com/t/how-to-display-the-number-of-problems-and-trends/48092 "2024-10-02T12:52:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Taihei](https://avatars.discourse-cdn.com/v4/letter/t/71e660/32.png) [@Taihei](https://community.dynatrace.com/u/Taihei)\
**Post date:** [October 2, 2024, 12:52pm UTC](https://community.dynatrace.com/t/how-to-display-the-number-of-problems-and-trends/48092/1 "2024-10-02T12:52:03Z")

</div>

I would like to use the single value visualization on the dashboard to display the number of PROBLEMS and trends by ENTITY TYPE.

I was able to display the following DQL for the number of PROBLEMS.

How can I display trend?

fetch dt.davis.problems  
|filter matchesValue(affected\_entity\_types,“dt.entity.process\_group\_instance”)  
| lookup [  
fetch dt.entity.process\_group\_instance  
], sourceField:affected\_entity\_ids, lookupField:id  
| fields root\_cause\_entity\_name, display\_id, event.category, event.start, timestamp

| summarize count()

---

<div class="post-metadata">

**Author:** ![PedroSantos](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/pedrosantos/32/28150_2.png) [@PedroSantos](https://community.dynatrace.com/u/PedroSantos)\
**Post date:** [October 2, 2024, 3:16pm UTC](https://community.dynatrace.com/t/how-to-display-the-number-of-problems-and-trends/48092/2 "2024-10-02T15:16:17Z")

</div>

Hello [@Taihei](https://community.dynatrace.com/user/69979) ,

I’m not sure I fully understood your problem. Correct me if I didn’t.

From what I gathered, you’re trying to see the trend that the number of problems from a given entity type follows. Is this correct?

Your query seems to be aiming at specifically following the number of problems that affect entity type “dt.entity.process\_group\_instance”.

I tried to do the same for problems affecting entity type host (If you’re only interested in the number of problems affecting a certain entity type, you do not need the lookup) :

```markup
fetch dt.davis.problems //fetch all problems
| filter matchesValue(affected_entity_types, "dt.entity.host") //filter for the entity_type you want
| makeTimeseries count(default: 0), // Use timeseries, default to 0 if no data
    interval: 15m // Set the time interval you need

```

With timeseries you can produce a number of values in intervals within your timeframe.

With the single value tile this produces the following:

 ![PedroSantos_1-1727879185168.png](https://global.discourse-cdn.com/dynatrace/original/2X/b/b3486b425907d6de300ad535febfaa36ac5b937a.png)

The array is the number of problems affecting Hosts over the course of 2 hours, with 15 minute intervals.

Then you can mess around with Visualize to make it look better:

 ![PedroSantos_0-1727881991422.png](https://global.discourse-cdn.com/dynatrace/original/3X/c/4/c458fe91ad0a89295cfa514b62ae3f5686fcddee.png)

 ![PedroSantos_2-1727879816616.png](https://global.discourse-cdn.com/dynatrace/original/2X/2/27172c6c3422380f1a1b24626338108251e52d21.png)

Note:

Do note that this:

```markup
fetch dt.davis.problems //fetch all problems
| filter matchesValue(affected_entity_types, "dt.entity.process_group_instance") //filter for the entity_type you want
| makeTimeseries count(default: 0), // Use timeseries
    interval: 15m // Set the time interval you need

```

And this:

```markup
fetch dt.davis.problems
|filter matchesValue(affected_entity_types,"dt.entity.process_group_instance")
| lookup [
fetch dt.entity.process_group_instance
], sourceField:affected_entity_ids, lookupField:id
|fields root_cause_entity_name, display_id, event.category, event.start, timestamp
| makeTimeseries count(default: 0), // Use timeseries
    interval: 15m // Set the time interval you need

```

Both these will, **for our purposes** , produce the exact same results. Because we’re using single value tiles, we don’t need the extra fields.

---

<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:** [October 2, 2024, 8:43pm UTC](https://community.dynatrace.com/t/how-to-display-the-number-of-problems-and-trends/48092/3 "2024-10-02T20:43:33Z")

</div>

Of course if you have a specific need for “singleValue” you can calculate it and keep in final query result. E.g. using query from&nbsp;[@PedroSantos](https://community.dynatrace.com/user/77112)&nbsp;:

```markup
fetch dt.davis.problems //fetch all problems
| filter matchesValue(affected_entity_types, "dt.entity.process_group_instance") //filter for the entity_type you want
| makeTimeseries sparkline=count(default: 0), // Use timeseries
    interval: 15m // Set the time interval you need
| fieldsAdd singleValue=arraySum(sparkline)

```

 ![krzysztof_hoja_0-1727901697237.png](https://global.discourse-cdn.com/dynatrace/original/2X/c/cbe108b9d439bef092ec4ee1afd8b07b63265d72.png)

If needed value cannot be calculated from timeseries used as sparkline you can always add needed value using _ **lookup** _ or _ **join** _ command
