<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Calculating a Rolling Summary in a DQL in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/Calculating-a-Rolling-Summary-in-a-DQL/m-p/224640#M275</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have the following DQL, which returns a time series of a metric "incoming count in last minute" from a custom extension/generic db query.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;timeseries query=sum(custom.db.query), :interval:1m,&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;filter:{in(dt.entity.custom_device,classicEntitySelector("type(custom_device),entityName.equals(\"Incoming count in last 1 mins\")"))},&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;by:{dt.entity.custom_device}&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;What I'm after is for every minute, return the incoming count for the last 60 minutes, i.e. calculating the total count for the last 60 minutes, every minute.&lt;BR /&gt;&lt;BR /&gt;I could define a db query and another metric to calculate this, but currently we're having performance/capacity issues so really don't want to add another custom db query when I should be able to derive the answer.&lt;BR /&gt;&lt;BR /&gt;P.S. bins or increasing the interval, doesn't give me the granularity I need to compare against existing charts.&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 08 Oct 2023 12:05:18 GMT</pubDate>
    <dc:creator>pmurray30</dc:creator>
    <dc:date>2023-10-08T12:05:18Z</dc:date>
    <item>
      <title>Calculating a Rolling Summary in a DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/Calculating-a-Rolling-Summary-in-a-DQL/m-p/224640#M275</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have the following DQL, which returns a time series of a metric "incoming count in last minute" from a custom extension/generic db query.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;timeseries query=sum(custom.db.query), :interval:1m,&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;filter:{in(dt.entity.custom_device,classicEntitySelector("type(custom_device),entityName.equals(\"Incoming count in last 1 mins\")"))},&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;by:{dt.entity.custom_device}&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;What I'm after is for every minute, return the incoming count for the last 60 minutes, i.e. calculating the total count for the last 60 minutes, every minute.&lt;BR /&gt;&lt;BR /&gt;I could define a db query and another metric to calculate this, but currently we're having performance/capacity issues so really don't want to add another custom db query when I should be able to derive the answer.&lt;BR /&gt;&lt;BR /&gt;P.S. bins or increasing the interval, doesn't give me the granularity I need to compare against existing charts.&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Oct 2023 12:05:18 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Calculating-a-Rolling-Summary-in-a-DQL/m-p/224640#M275</guid>
      <dc:creator>pmurray30</dc:creator>
      <dc:date>2023-10-08T12:05:18Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating a Rolling Summary in a DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/Calculating-a-Rolling-Summary-in-a-DQL/m-p/262431#M1434</link>
      <description>&lt;P&gt;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/67453"&gt;@pmurray30&lt;/a&gt;&amp;nbsp;- were you able to get a query for this, or a solution?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 12:57:11 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Calculating-a-Rolling-Summary-in-a-DQL/m-p/262431#M1434</guid>
      <dc:creator>ChadTurner</dc:creator>
      <dc:date>2024-11-14T12:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating a Rolling Summary in a DQL</title>
      <link>https://community.dynatrace.com/t5/DQL/Calculating-a-Rolling-Summary-in-a-DQL/m-p/262512#M1438</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/14877"&gt;@ChadTurner&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;At the time no, but after a year more of experience, it took me a couple of hours to come up with this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;timeseries {QueryRslt=Max(custom.db.query), timestamp=start()}, by: { dt.entity.custom_device } , 
  interval:1m, 
  filter: { in(dt.entity.custom_device, 
  classicEntitySelector("type(custom_device),entityName.equals(\"Incremental Count\")")) }
| fieldsAdd key = tolong(timestamp[]-arrayFirst(timestamp))/1000000000
| join on:{key} , 
  [timeseries {QueryRslt=Max(custom.db.query), timestamp=start()}, by: { dt.entity.custom_device }, 
    interval:1m, shift:-10m, 
    filter: { in(dt.entity.custom_device, 
    classicEntitySelector("type(custom_device),entityName.equals(\"Incremental Count\")")) }
  | fieldsAdd key = tolong(timestamp[]-arrayFirst(timestamp))/1000000000] 
| fieldsAdd delta=QueryRslt[]-right.QueryRslt[]
| fields timeframe, interval, delta&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;This works with a incremental count, but should be able to be adapted to a minute reading if you have more joins and add the readings.&lt;/P&gt;&lt;P&gt;Maybe there is a cleaner way of doing it, but at the time I ended up just adding another custom query.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 18:01:44 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Calculating-a-Rolling-Summary-in-a-DQL/m-p/262512#M1438</guid>
      <dc:creator>pmurray30</dc:creator>
      <dc:date>2024-11-14T18:01:44Z</dc:date>
    </item>
  </channel>
</rss>

