<?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: Trying to get a single value from the difference of 2 timeseries values, same dimensions, different values... in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/Trying-to-get-a-single-value-from-the-difference-of-2-timeseries/m-p/245897#M904</link>
    <description>&lt;P&gt;This is exactly what &lt;EM&gt;&lt;STRONG&gt;append&lt;/STRONG&gt;&lt;/EM&gt; does: adds new records. First part of the query added 1st record, then with append you added 2nd.&lt;BR /&gt;&lt;BR /&gt;But it is possible to merge both into single one (i am using metrics available on my tenant):&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;timeseries east=avg(dt.cloud.aws.alb.bytes), by:{aws.region}, filter:aws.region=="us-east-1"
| append [
timeseries west=avg(dt.cloud.aws.alb.bytes), by:{aws.region}, filter:aws.region=="us-west-2"
]
| fields east=arraySum(east), west=arraySum(west)
| summarize {east=takeAny(east), west=takeAny(west)}&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="krzysztof_hoja_0-1715932469880.png" style="width: 729px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/19916iDF0AB9EA50C94D56/image-dimensions/729x286?v=v2" width="729" height="286" role="button" title="krzysztof_hoja_0-1715932469880.png" alt="krzysztof_hoja_0-1715932469880.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kris&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 17 May 2024 07:56:00 GMT</pubDate>
    <dc:creator>krzysztof_hoja</dc:creator>
    <dc:date>2024-05-17T07:56:00Z</dc:date>
    <item>
      <title>Trying to get a single value from the difference of 2 timeseries values, same dimensions, different values...</title>
      <link>https://community.dynatrace.com/t5/DQL/Trying-to-get-a-single-value-from-the-difference-of-2-timeseries/m-p/245868#M902</link>
      <description>&lt;P&gt;I've been working to create a single value block on a notebook where I'm fetching two different timeseries values that use the same metric. The dimensions on this metric are by environment and region (region meaning the region of an EKS Kubernetes cluster). The trick is that for each value, they both have a distinct region. Here's my query so far:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;timeseries east_count = sum(`custom-metric`, default:0), by:{env, region}
| filter env == "dev"
| filter region == "region-1"
| append [
  timeseries west_count = sum(`custom-metric`, default:0), by:{env, region}
  | filter env == "dev"
  | filter region == "region-2"
]
| fields east=arraySum(east_count), west=arraySum(west_count)&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;I am not currently running the difference between the two because I want to see what both values equate to. I would expect by running this query to get a single record with 2 fields, but I appear to be getting two records, each of which have both fields. The records end up coming back like this:&lt;BR /&gt;&lt;BR /&gt;record1: east: 6000, west: null&lt;/P&gt;&lt;P&gt;record2: east: null, west: 6500&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Where have I gone wrong here in returning two records rather than a single record?&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2024 21:17:27 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Trying-to-get-a-single-value-from-the-difference-of-2-timeseries/m-p/245868#M902</guid>
      <dc:creator>calogajac</dc:creator>
      <dc:date>2024-05-16T21:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to get a single value from the difference of 2 timeseries values, same dimensions, different values...</title>
      <link>https://community.dynatrace.com/t5/DQL/Trying-to-get-a-single-value-from-the-difference-of-2-timeseries/m-p/245897#M904</link>
      <description>&lt;P&gt;This is exactly what &lt;EM&gt;&lt;STRONG&gt;append&lt;/STRONG&gt;&lt;/EM&gt; does: adds new records. First part of the query added 1st record, then with append you added 2nd.&lt;BR /&gt;&lt;BR /&gt;But it is possible to merge both into single one (i am using metrics available on my tenant):&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;timeseries east=avg(dt.cloud.aws.alb.bytes), by:{aws.region}, filter:aws.region=="us-east-1"
| append [
timeseries west=avg(dt.cloud.aws.alb.bytes), by:{aws.region}, filter:aws.region=="us-west-2"
]
| fields east=arraySum(east), west=arraySum(west)
| summarize {east=takeAny(east), west=takeAny(west)}&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="krzysztof_hoja_0-1715932469880.png" style="width: 729px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/19916iDF0AB9EA50C94D56/image-dimensions/729x286?v=v2" width="729" height="286" role="button" title="krzysztof_hoja_0-1715932469880.png" alt="krzysztof_hoja_0-1715932469880.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kris&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2024 07:56:00 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Trying-to-get-a-single-value-from-the-difference-of-2-timeseries/m-p/245897#M904</guid>
      <dc:creator>krzysztof_hoja</dc:creator>
      <dc:date>2024-05-17T07:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to get a single value from the difference of 2 timeseries values, same dimensions, different values...</title>
      <link>https://community.dynatrace.com/t5/DQL/Trying-to-get-a-single-value-from-the-difference-of-2-timeseries/m-p/245926#M905</link>
      <description>&lt;P&gt;Thanks Kris! There is definitely a better way to do this, I'm sure, but your suggestion got me to the desired solution with a couple small tweaks. Appreciate the help!&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2024 13:06:43 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Trying-to-get-a-single-value-from-the-difference-of-2-timeseries/m-p/245926#M905</guid>
      <dc:creator>calogajac</dc:creator>
      <dc:date>2024-05-17T13:06:43Z</dc:date>
    </item>
  </channel>
</rss>

