# Use makeTimeseries with fetch entity for Advanced DQL Time-Series Queries

**URL:** <https://community.dynatrace.com/t/use-maketimeseries-with-fetch-entity-for-advanced-dql-time-series-queries/49206>\
**Category:** DQL\
**Tags:** dql, problem-detection, threshold\
**Created:** [December 4, 2024, 7:35pm UTC](https://community.dynatrace.com/t/use-maketimeseries-with-fetch-entity-for-advanced-dql-time-series-queries/49206 "2024-12-04T19:35:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![FShimaya](https://avatars.discourse-cdn.com/v4/letter/f/c6cbf5/32.png) [@FShimaya](https://community.dynatrace.com/u/FShimaya)\
**Post date:** [December 4, 2024, 7:35pm UTC](https://community.dynatrace.com/t/use-maketimeseries-with-fetch-entity-for-advanced-dql-time-series-queries/49206/1 "2024-12-04T19:35:49Z")

</div>

I would like a DQL statement (either in Dashboard or Notebook) to perform the following query and result in an event so that query results are alertable depending on the threshold. &nbsp;In this case, I would like an event generated when DQL query results in a downtime value greater than 3600 seconds. &nbsp;Here is the statement:

fetch dt.entity.cloud\_application\_instance, from:now()-24h  
| fieldsAdd entity.name, lifetime, downtime = unixSecondsFromTimestamp(now()) - unixSecondsFromTimestamp(lifetime[start])&nbsp;  
| filter in(id, classicEntitySelector(“type(CLOUD\_APPLICATION\_INSTANCE),toRelationships.IS\_PG\_OF\_CAI(type(PROCESS\_GROUP), tag(kpod))”))  
| fieldsAdd duration(downtime, unit:“s”), alias:duration&nbsp;  
| filterOut downtime \< 3600  
| makeTimeseries count(default: 0), spread: timeframe(from: lifetime[start], to: coalesce(lifetime[end], now())), by:{entity.name,duration}, interval: 1m  
| limit 200| makeTimeseries count(default: 0), by:{entityName,isOffline,timestamp}, time:{timestamp}, interval: 1m

But when I run this query, I get the following error message:

Analyzer execution failedDQL result data could not be treated as a timeseries. No valid time series records found. A valid time series record containsa single duration field, a single timeframe and one or multiple numeric arrays. Consider using the ‘timeseries’ or ‘makeTimeseries’ DQL command.What do I need to do to fix this DQL statement ?

| filterOut downtime \< 3600

---

<div class="post-metadata">

**Author:** ![izabelarokita](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/izabelarokita/32/41812_2.png) [@izabelarokita](https://community.dynatrace.com/u/izabelarokita)\
**Post date:** [December 17, 2025, 12:07pm UTC](https://community.dynatrace.com/t/use-maketimeseries-with-fetch-entity-for-advanced-dql-time-series-queries/49206/2 "2025-12-17T12:07:30Z")

</div>

Hey&nbsp;[@FShimaya](https://community.dynatrace.com/user/39337)&nbsp;,  
I just wanted to check in and see if you still need help with this. If so, I’d be happy to look into it for you!&nbsp;:blush:  
Please let me know what works best for you.

---

<div class="post-metadata">

**Author:** ![FShimaya](https://avatars.discourse-cdn.com/v4/letter/f/c6cbf5/32.png) [@FShimaya](https://community.dynatrace.com/u/FShimaya)\
**Post date:** [November 18, 2026, 6:48pm UTC](https://community.dynatrace.com/t/use-maketimeseries-with-fetch-entity-for-advanced-dql-time-series-queries/49206/3 "2026-11-18T18:48:57Z")

</div>

Hi Izabel,

Sorry for the belated response. Yes, any help regarding this would be much appreciated.

---

<div class="post-metadata">

**Author:** ![Gaurav\_Shelke](https://avatars.discourse-cdn.com/v4/letter/g/e274bd/32.png) [@Gaurav\_Shelke](https://community.dynatrace.com/u/Gaurav_Shelke)\
**Post date:** [November 19, 2026, 5:42am UTC](https://community.dynatrace.com/t/use-maketimeseries-with-fetch-entity-for-advanced-dql-time-series-queries/49206/4 "2026-11-19T05:42:01Z")

</div>

Hi @FShimaya,

If your requirement is to evaluate the data over the last 24 hours, you can keep your existing DQL query and use it directly in a Workflow:

```auto
fetch dt.entity.cloud_application_instance, from: now()-24h

| fieldsAdd entity.name, lifetime,

downtime = unixSecondsFromTimestamp(now()) - unixSecondsFromTimestamp(lifetime\[start\])

| filter in(

id,

classicEntitySelector(

  "type(CLOUD_APPLICATION_INSTANCE),toRelationships.IS_PG_OF_CAI(type(PROCESS_GROUP),tag(kpod))"

)

)

| fieldsAdd duration(downtime, unit:"s"), alias:duration

| filter downtime >= 3600

| fields entity.name, downtime, duration

```

When using `maketimeseries` in a Davis alert, the evaluation is performed on time-series data with a 1-minute resolution/evaluation interval. For a use case where you want to evaluate a 24-hour lookback window and trigger an alert based on the query result, a Workflow can be a better fit.

A possible approach would be:

1. Create a Workflow with a scheduled trigger.

2. Add the DQL query above.

3. Configure the JavaScript action to run only when the DQL query returns results (for example, using a run condition based on the query output count).

4. Use a JavaScript action to create a custom event or send a notification . Below is an

Hope this helps
