<?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 Re: Difference DQL Calculate diference of two timeseries metrics in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/Difference-DQL-Calculate-diference-of-two-timeseries-metrics/m-p/296767#M3228</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/31213"&gt;@robert_laurat&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;timeseries&lt;/STRONG&gt; returns arrays, so &lt;STRONG&gt;publish_count&lt;/STRONG&gt; and &lt;STRONG&gt;receive_count&lt;/STRONG&gt; are not single values.&lt;BR /&gt;Also, empty buckets are &lt;STRONG&gt;null&lt;/STRONG&gt; unless you set default: &lt;STRONG&gt;0.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Try this for the &lt;STRONG&gt;difference&lt;/STRONG&gt; over time:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;timeseries {
  publish_count = sum(dt.service.messaging.publish.count, default: 0),
  receive_count = sum(dt.service.messaging.receive.count, default: 0)
}, by: { messaging.destination.name }
| fieldsAdd difference = publish_count[] - receive_count[]&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="timeseries-robert.png" style="width: 511px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/32483iF57F01B546E30E8B/image-dimensions/511x244?v=v2" width="511" height="244" role="button" title="timeseries-robert.png" alt="timeseries-robert.png" /&gt;&lt;/span&gt;That gives you a &lt;STRONG&gt;difference&lt;/STRONG&gt; array for each destination, one value per time bucket. Dynatrace supports iterative array expressions like this with &lt;STRONG&gt;[].&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps you &lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 26 Mar 2026 17:21:14 GMT</pubDate>
    <dc:creator>MaximilianoML</dc:creator>
    <dc:date>2026-03-26T17:21:14Z</dc:date>
    <item>
      <title>Difference DQL Calculate diference of two timeseries metrics</title>
      <link>https://community.dynatrace.com/t5/DQL/Difference-DQL-Calculate-diference-of-two-timeseries-metrics/m-p/296765#M3227</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;
&lt;P&gt;I want to create a difference between two metrics over the time. For example to show the differnece between published and processed queue messages.&lt;BR /&gt;How to do this with DQL?&lt;/P&gt;
&lt;P&gt;I tried to start with this command.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;timeseries {publish_count = sum(dt.service.messaging.publish.count), receive_count = sum(dt.service.messaging.receive.count)}, by:{messaging.destination.name}
| fieldsAdd difference = publish_count - receive_count
| summarize by:{messaging.destination.name}, total_difference = sum(difference)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But this just return null.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Robert&lt;/P&gt;</description>
      <pubDate>Fri, 27 Mar 2026 10:45:26 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Difference-DQL-Calculate-diference-of-two-timeseries-metrics/m-p/296765#M3227</guid>
      <dc:creator>robert_laurat</dc:creator>
      <dc:date>2026-03-27T10:45:26Z</dc:date>
    </item>
    <item>
      <title>Re: Difference DQL Calculate diference of two timeseries metrics</title>
      <link>https://community.dynatrace.com/t5/DQL/Difference-DQL-Calculate-diference-of-two-timeseries-metrics/m-p/296767#M3228</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/31213"&gt;@robert_laurat&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;timeseries&lt;/STRONG&gt; returns arrays, so &lt;STRONG&gt;publish_count&lt;/STRONG&gt; and &lt;STRONG&gt;receive_count&lt;/STRONG&gt; are not single values.&lt;BR /&gt;Also, empty buckets are &lt;STRONG&gt;null&lt;/STRONG&gt; unless you set default: &lt;STRONG&gt;0.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Try this for the &lt;STRONG&gt;difference&lt;/STRONG&gt; over time:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;timeseries {
  publish_count = sum(dt.service.messaging.publish.count, default: 0),
  receive_count = sum(dt.service.messaging.receive.count, default: 0)
}, by: { messaging.destination.name }
| fieldsAdd difference = publish_count[] - receive_count[]&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="timeseries-robert.png" style="width: 511px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/32483iF57F01B546E30E8B/image-dimensions/511x244?v=v2" width="511" height="244" role="button" title="timeseries-robert.png" alt="timeseries-robert.png" /&gt;&lt;/span&gt;That gives you a &lt;STRONG&gt;difference&lt;/STRONG&gt; array for each destination, one value per time bucket. Dynatrace supports iterative array expressions like this with &lt;STRONG&gt;[].&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps you &lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Mar 2026 17:21:14 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Difference-DQL-Calculate-diference-of-two-timeseries-metrics/m-p/296767#M3228</guid>
      <dc:creator>MaximilianoML</dc:creator>
      <dc:date>2026-03-26T17:21:14Z</dc:date>
    </item>
    <item>
      <title>Re: Difference DQL Calculate diference of two timeseries metrics</title>
      <link>https://community.dynatrace.com/t5/DQL/Difference-DQL-Calculate-diference-of-two-timeseries-metrics/m-p/296788#M3229</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/73851"&gt;@MaximilianoML&lt;/a&gt;,&amp;nbsp;the default:0&amp;nbsp; was the trick.&lt;/P&gt;&lt;P&gt;I also tried to explicitly set [] at the calculation, but without success.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Robert&lt;/P&gt;</description>
      <pubDate>Fri, 27 Mar 2026 07:04:19 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Difference-DQL-Calculate-diference-of-two-timeseries-metrics/m-p/296788#M3229</guid>
      <dc:creator>robert_laurat</dc:creator>
      <dc:date>2026-03-27T07:04:19Z</dc:date>
    </item>
  </channel>
</rss>

