# Expand DQL TimeFrame

**URL:** <https://community.dynatrace.com/t/expand-dql-timeframe/47230>\
**Category:** DQL\
**Tags:** dql, timeframe, notebooks\
**Created:** [August 21, 2024, 9:06am UTC](https://community.dynatrace.com/t/expand-dql-timeframe/47230 "2024-08-21T09:06:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![WessOtter](https://avatars.discourse-cdn.com/v4/letter/w/f4b2a3/32.png) [@WessOtter](https://community.dynatrace.com/u/WessOtter)\
**Post date:** [August 21, 2024, 9:06am UTC](https://community.dynatrace.com/t/expand-dql-timeframe/47230/1 "2024-08-21T09:06:43Z")

</div>

Hi,

I am trying to create a row-by-row comparison in DQL. However, the query so far is a time frame and hence one row. I want to create a row for each interval in the time frame. But I can’t find a way to expand this time frame. Does anyone know how I can create a new row for each interval?

This the query so far.

timeseries ThisWeek = avg(log.payment.amounteur),  
from: now() -30m,  
by: { payment.status, payment.airline },  
filter: { payment.status == “APPROVED”  
AND payment.airline == “KL” }  
| join on: { payment.status, payment.airline },  
[timeseries LastWeek = avg(log.payment.amounteur),  
by: { payment.status, payment.airline }, shift: -24h],  
fields: {LastWeek}  
| fields timeframe, ThisWeek, LastWeek

---

<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:** [August 29, 2024, 11:59am UTC](https://community.dynatrace.com/t/expand-dql-timeframe/47230/2 "2024-08-29T11:59:25Z")

</div>

It is doable using using special _**start()**_ or _**end()**_ functions which can be used in _ **timeseries** _ command to produce timeseries with timestamps and use of _ **expand** _ command. _ **Expand** _ without additions I mentioned of course works, but you will loose time information for datapoint.

Here is example query on demo data:

```markup
timeseries cpu=avg(dt.host.cpu.usage), t=start()
| fieldsAdd cput = record(cpu=cpu[], t=t[])
| expand cput
| fields cpu=cput[cpu], t=cput[t]

```

and result looks like this:

 ![krzysztof_hoja_0-1724932637078.png](https://global.discourse-cdn.com/dynatrace/original/3X/4/c/4c3b5cb2cf4dc5588cea3fab4d8c05e08e8873bc.png)

But I think some comparisons can be also made using timeseries (arrays) without expanding as corresponding values have same index in the arrays). What comparison do you want to make?

Kris
