# Top 10 Values Timeseries with Additional 'Other' Aggregate Category

**URL:** <https://community.dynatrace.com/t/top-10-values-timeseries-with-additional-other-aggregate-category/43563>\
**Category:** DQL\
**Tags:** dql, logs\
**Created:** [January 11, 2024, 11:33am UTC](https://community.dynatrace.com/t/top-10-values-timeseries-with-additional-other-aggregate-category/43563 "2024-01-11T11:33:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jegron](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/jegron/32/12797_2.png) [@jegron](https://community.dynatrace.com/u/jegron)\
**Post date:** [January 11, 2024, 11:33am UTC](https://community.dynatrace.com/t/top-10-values-timeseries-with-additional-other-aggregate-category/43563/1 "2024-01-11T11:33:15Z")

</div>

Hi,

I would like&nbsp;to construct a timeseries that includes a set number of the highest values, plus an additional aggregated category named ‘Other.’ This ‘Other’ category should represent the sum of all the remaining values not included in the set limit of highest values :

 ![CountbyIP.png](https://global.discourse-cdn.com/dynatrace/original/2X/9/99d3dd02f583fb9a917b34b3b32f3d21c771fbe8.png)

How can I do that ?

_fetch logs_  
_| makeTimeseries count(default:0), by:{src\_ip}_  
_| limit 10_

Thanks!

Julien

---

<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:** [January 11, 2024, 8:05pm UTC](https://community.dynatrace.com/t/top-10-values-timeseries-with-additional-other-aggregate-category/43563/2 "2024-01-11T20:05:51Z")

</div>

After producing timeseries for all IPs  
- you need to collect them in single array,  
- sort it by chosen order (I selected sum of all value in timeseries as a ordering criteria, kept in _ **o** _ field of the record)  
- remember the 10th value from the array in fields _ **top** _  
- expand and summarize again by srcaddr, but it will be replaced with “Other” word when value of _ **o** _ field is lower then remembered threshold (_ **top** _)

```markup
fetch logs
| filter ipIn(srcaddr,"10.179.22.0/24")
| makeTimeseries {c=count()}, by:{srcaddr}, interval:5m

| summarize { d=collectArray( record(o=arraySum(c), srcaddr, c)) }, by:{timeframe, interval}
| fieldsAdd d=arraySort(d, direction:"descending" )
| fieldsAdd top=d[9][o]

| expand d
| fieldsAdd srcaddr = if( isTrueOrNull(d[o]>=top), d[srcaddr], else:"Other")
| summarize c=sum(d[c][]), by:{srcaddr, timeframe, interval}

```

Just note: this can give you more then 10 top timeseries if 11th element has the same value of _ **o** _ as 10th, etc…

Kris

 ![krzysztof_hoja_0-1705003497778.png](https://global.discourse-cdn.com/dynatrace/original/3X/0/c/0c5227f4775c7b8f34d8e9b2a4c644908f239b99.png)

---

<div class="post-metadata">

**Author:** ![jegron](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/jegron/32/12797_2.png) [@jegron](https://community.dynatrace.com/u/jegron)\
**Post date:** [January 15, 2024, 9:31am UTC](https://community.dynatrace.com/t/top-10-values-timeseries-with-additional-other-aggregate-category/43563/3 "2024-01-15T09:31:21Z")

</div>

Hi,

Thanks !

 ![jegron_1-1705310933545.png](https://global.discourse-cdn.com/dynatrace/original/3X/d/0/d0a066ee48828048e6680845b145b811d1daffde.png)

I don’t understand why there is the “C” value here. What does it mean ?

Also Does Dynatrace plan to release an “useother” option for Timeseries like competitor?

Example :

**Syntax:** &nbsp;useother=\<bool\>

**Description:** &nbsp;You specify which series to include in the results table by using the \<agg\>, \<limit\>, and \<where-clause\> options. The&nbsp;useother&nbsp;option specifies whether to merge all of the series not included in the results table into a single new series. If&nbsp;useother=true, the label for the series is controlled by the&nbsp;otherstr&nbsp;option.

**Default:** &nbsp;true

If not I can write an RFE 🙂

Julien

---

<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:** [January 17, 2024, 7:27am UTC](https://community.dynatrace.com/t/top-10-values-timeseries-with-additional-other-aggregate-category/43563/4 "2024-01-17T07:27:13Z")

</div>

Apparently there are record where&nbsp;srcaddr is null. When the dimension (name of timeseries) is null, the timeseries field name (_ **c** _) is used in chart legend. To confirm this, you can display your data in form of table or record list.

Also I agree with you that ‘useother’ option would be very useful. Moreover such extension would be needed not only as a part makeTimeseries, but also as a part of timeseries for out native metrics. Please go ahead with RFE.  
On the other side, DQL is flexible and powerful enough so such data manipulations are possible before implementation of specialized features happens.
