# DQL timeseries: aggregate data based on lookup fields

**URL:** <https://community.dynatrace.com/t/dql-timeseries-aggregate-data-based-on-lookup-fields/41206>\
**Category:** DQL\
**Tags:** dql, dynatrace-managed\
**Created:** [August 14, 2023, 9:11pm UTC](https://community.dynatrace.com/t/dql-timeseries-aggregate-data-based-on-lookup-fields/41206 "2023-08-14T21:11:37Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adrien\_Z](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@Adrien\_Z](https://community.dynatrace.com/u/Adrien_Z)\
**Post date:** [August 14, 2023, 9:11pm UTC](https://community.dynatrace.com/t/dql-timeseries-aggregate-data-based-on-lookup-fields/41206/1 "2023-08-14T21:11:37Z")

</div>

Hello,

I’m trying to group a timeseries based on new fields I fetch after a lookup.

So basically, I’m fetching a timeseries (here dt.kubernetes.node\_conditions). Then, I lookup the kubernetes nodes to get a specific label and the managementZone.

After that, I would like to group the timeseries based on this label and the management zone.

For example:

```markup
timeseries avg(dt.kubernetes.node.conditions), by:{dt.entity.kubernetes_node}, interval: 10m
| lookup [fetch dt.entity.kubernetes_node], sourceField:dt.entity.kubernetes_node, lookupField:id
| fieldsAdd node_type = lookup.kubernetesLabels[`kube/nodetype`], managementZone = lookup.managementZones

```

I didn’t find a way to group the timeseries avg(dt.kubernetes.node.conditions) based on these new fields.

Is it something possible ?

---

<div class="post-metadata">

**Author:** ![fcourbon](https://avatars.discourse-cdn.com/v4/letter/f/df788c/32.png) [@fcourbon](https://community.dynatrace.com/u/fcourbon)\
**Post date:** [August 16, 2023, 9:30am UTC](https://community.dynatrace.com/t/dql-timeseries-aggregate-data-based-on-lookup-fields/41206/2 "2023-08-16T09:30:00Z")

</div>

Hello&nbsp;[@Adrien\_Z](https://community.dynatrace.com/user/62507)&nbsp;, what kind of output are you expecting ? A time series or a single scalar per node\_type (or managementZone)?

---

<div class="post-metadata">

**Author:** ![Adrien\_Z](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@Adrien\_Z](https://community.dynatrace.com/u/Adrien_Z)\
**Post date:** [August 16, 2023, 12:23pm UTC](https://community.dynatrace.com/t/dql-timeseries-aggregate-data-based-on-lookup-fields/41206/3 "2023-08-16T12:23:38Z")

</div>

Hello,

I want a time series per node\_type that will represent the sum of the timeseries of all nodes having this node\_type.

for example:

```markup
node |avg(dt.kubernetes.node.condition)|node_type
nodeA|1,1,,,1 |typeA
nodeB|,1,1,1, |typeA

Result: -->
node_type|avg(dt.kubernetes.node.condition)
typeA |1,2,2,1,1

```

Let me know if you need more information

---

<div class="post-metadata">

**Author:** ![fcourbon](https://avatars.discourse-cdn.com/v4/letter/f/df788c/32.png) [@fcourbon](https://community.dynatrace.com/u/fcourbon)\
**Post date:** [August 16, 2023, 3:02pm UTC](https://community.dynatrace.com/t/dql-timeseries-aggregate-data-based-on-lookup-fields/41206/4 "2023-08-16T15:02:16Z")

</div>

Thanks for the additional information, this will be possible with an enhancement that will be delivered this year. I will revert with the syntax once it is made available.

---

<div class="post-metadata">

**Author:** ![Adrien\_Z](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@Adrien\_Z](https://community.dynatrace.com/u/Adrien_Z)\
**Post date:** [August 17, 2023, 5:44pm UTC](https://community.dynatrace.com/t/dql-timeseries-aggregate-data-based-on-lookup-fields/41206/5 "2023-08-17T17:44:25Z")

</div>

Hello,

Thank you for the information.

I’ll wait for the update of this tread

---

<div class="post-metadata">

**Author:** ![Tommaso\_Fin](https://avatars.discourse-cdn.com/v4/letter/t/f475e1/32.png) [@Tommaso\_Fin](https://community.dynatrace.com/u/Tommaso_Fin)\
**Post date:** [March 11, 2024, 3:24pm UTC](https://community.dynatrace.com/t/dql-timeseries-aggregate-data-based-on-lookup-fields/41206/6 "2024-03-11T15:24:33Z")

</div>

Hi,

I would need this feature too. Since 2023 is over, is it possible now to do so?

thanks

---

<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:** [March 12, 2024, 6:40pm UTC](https://community.dynatrace.com/t/dql-timeseries-aggregate-data-based-on-lookup-fields/41206/7 "2024-03-12T18:40:06Z")

</div>

It is possible right now. Using the initial example it would look like time:

```markup
timeseries cond=avg(dt.kubernetes.node.conditions), by:{dt.entity.kubernetes_node}, interval: 10m
| lookup [fetch dt.entity.kubernetes_node], sourceField:dt.entity.kubernetes_node, lookupField:id
| fieldsAdd node_type = lookup.kubernetesLabels[`kube/nodetype`], managementZone = lookup.managementZones
| summarize {cond=sum(cond[])}, by:{node_type, managementZone, interval, timeframe}

```

-Kris

---

<div class="post-metadata">

**Author:** ![Tommaso\_Fin](https://avatars.discourse-cdn.com/v4/letter/t/f475e1/32.png) [@Tommaso\_Fin](https://community.dynatrace.com/u/Tommaso_Fin)\
**Post date:** [March 13, 2024, 1:24pm UTC](https://community.dynatrace.com/t/dql-timeseries-aggregate-data-based-on-lookup-fields/41206/8 "2024-03-13T13:24:03Z")

</div>

Thanks, it work fine, even if I would never find the solution without your help. The sintax is not really simple

---

<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:** [March 13, 2024, 1:42pm UTC](https://community.dynatrace.com/t/dql-timeseries-aggregate-data-based-on-lookup-fields/41206/9 "2024-03-13T13:42:47Z")

</div>

For future reference:

> **[summarize - DQL aggregation commands](https://docs.dynatrace.com/docs/platform/grail/dynatrace-query-language/commands/aggregation-commands#summarize)**
>
> The fieldsSummary command calculates the cardinality of field values that the specified fields have. | DQL aggregation commands

Example 6

---

<div class="post-metadata">

**Author:** ![Adrien\_Z](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@Adrien\_Z](https://community.dynatrace.com/u/Adrien_Z)\
**Post date:** [March 13, 2024, 2:48pm UTC](https://community.dynatrace.com/t/dql-timeseries-aggregate-data-based-on-lookup-fields/41206/10 "2024-03-13T14:48:30Z")

</div>

Thank you. It is working now and thanks for the example.

---

<div class="post-metadata">

**Author:** ![m\_zol](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@m\_zol](https://community.dynatrace.com/u/m_zol)\
**Post date:** [July 18, 2025, 1:50pm UTC](https://community.dynatrace.com/t/dql-timeseries-aggregate-data-based-on-lookup-fields/41206/11 "2025-07-18T13:50:12Z")

</div>

Hello,

thanks for the example, it helped me in parts.  
Seems the result above comes in a table. Is there any way to timeseries the data again?

---

<div class="post-metadata">

**Author:** ![m\_zol](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@m\_zol](https://community.dynatrace.com/u/m_zol)\
**Post date:** [July 18, 2025, 2:51pm UTC](https://community.dynatrace.com/t/dql-timeseries-aggregate-data-based-on-lookup-fields/41206/12 "2025-07-18T14:51:23Z")

</div>

Nevermind, with the example provided did work. I don’t know the reason it was not working before.
