# Extracting Date and Time of a Value within a Timeframe in Dynatrace DQL

**URL:** <https://community.dynatrace.com/t/extracting-date-and-time-of-a-value-within-a-timeframe-in-dynatrace-dql/49120>\
**Category:** DQL\
**Tags:** dql, timeframe, timeseries\
**Created:** [November 28, 2024, 9:00pm UTC](https://community.dynatrace.com/t/extracting-date-and-time-of-a-value-within-a-timeframe-in-dynatrace-dql/49120 "2024-11-28T21:00:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![PenteadoDouglas](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/penteadodouglas/32/21577_2.png) [@PenteadoDouglas](https://community.dynatrace.com/u/PenteadoDouglas)\
**Post date:** [November 28, 2024, 9:00pm UTC](https://community.dynatrace.com/t/extracting-date-and-time-of-a-value-within-a-timeframe-in-dynatrace-dql/49120/1 "2024-11-28T21:00:41Z")

</div>

Hello,

Hello, everyone! I need help creating a DQL query to extract the exact date and time of a record within a timeframe. In the example from the image, I would like to apply a filter for values \>= 890k (but it could be any value in the filter) and capture the corresponding timestamp. In the attached screenshot, the record would be at 04:36. Currently, I’m using the following DQL as a starting point:

timeseries count = max(dt.service.request.count, rollup: sum)

Can someone guide me on how to adjust the query to meet this requirement?

Thank you!

Douglas Penteado

 ![dql.png](https://global.discourse-cdn.com/dynatrace/original/3X/c/f/cf2f978203eb6d4599be15fc4b94bb34e091123b.png)

---

<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:** [November 29, 2024, 8:57am UTC](https://community.dynatrace.com/t/extracting-date-and-time-of-a-value-within-a-timeframe-in-dynatrace-dql/49120/2 "2024-11-29T08:57:54Z")

</div>

On my environment it looks like this:

 ![krzysztof_hoja_0-1732870452930.png](https://global.discourse-cdn.com/dynatrace/original/2X/a/aafc0979186acbfdcc20d7a8a59fc93e3f8f9e37.png)

and the query to get timestamps of datapoints above certain thresholds (1800 in my example) can look like this:

```markup
timeseries count = max(dt.service.request.count, rollup: sum), timestamp=start()
| fieldsAdd d=record(count=count[], timestamp=timestamp[])
| fieldsAdd d = arrayRemoveNulls( iCollectArray( if(d[][count]>1800, d[] )))
| expand d
| fields timestamp=d[timestamp], count=d[count]

```

 ![krzysztof_hoja_1-1732870544172.png](https://global.discourse-cdn.com/dynatrace/original/3X/3/c/3cbaf35b99c1892eb3d4d3f3300fbca8808c965e.png)

Iterative expressions are very useful for array processing (in this case filtering).  
Also to get this task done you need to know timestamp for each datapoint. For this _**start()**_ or _**end()**_ special timeseries. are needed

---

<div class="post-metadata">

**Author:** ![PenteadoDouglas](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/penteadodouglas/32/21577_2.png) [@PenteadoDouglas](https://community.dynatrace.com/u/PenteadoDouglas)\
**Post date:** [December 2, 2024, 6:24pm UTC](https://community.dynatrace.com/t/extracting-date-and-time-of-a-value-within-a-timeframe-in-dynatrace-dql/49120/3 "2024-12-02T18:24:07Z")

</div>

that’s it, thank you
