<?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 Aggregation of data from custom metric in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/Aggregation-of-data-from-custom-metric/m-p/276820#M2045</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am currently working on a Dashboard element that requires me to show error data coming from custom AWS metric. Basic DQL query in the Notebook:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;timeseries sum(`my_custom_aws_metric`),
  interval: 1d,
  from: "2025-05-05",
  by: {aws.account.id, app_name, db_name, table_name},
  filter: { matchesValue(aws.account.id, { “1234” })}
| fieldsAdd error_count = arraySum(`sum(\`my_custom_aws_metric\`)`) 
| fieldsKeep timeframe, app_name, db_name, table_name, aws.account.id, error_count
| filterOut error_count == 0&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;produces the following output:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="andykrk_0-1746788124121.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/27911i9621895858DFFD43/image-size/medium?v=v2&amp;amp;px=400" role="button" title="andykrk_0-1746788124121.png" alt="andykrk_0-1746788124121.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I am trying to breakdown the timeframe and aggregation into daily chunks. I have tested multiple ways like for example:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;timeseries {
  error_count   = sum(`my_custom_aws_metric`),  
  bucket_start  = start(),           
  bucket_end    = end()              
},
interval: 1d,
from: "2025-05-05",
to:   "2025-05-07",                    
by: {
  aws.account.id,
  app_name,
  db_name,
  table_name
},
filter: { aws.account.id == "1234" }   
| expand error_count
| expand bucket_start
| expand bucket_end
| filter   app_name    == “some_app”
| filterOut error_count == 0 or isNull(error_count)
| fieldsRename
    start = bucket_start,
    end   = bucket_end
| fieldsKeep start, end, error_count,
             aws.account.id, app_name, db_name, table_name
| sort      start asc&lt;/LI-CODE&gt;&lt;P&gt;but it produced overlapping time intervals (I guess because of multiple expand commands) and also presented total error count from the whole period for each line:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="andykrk_1-1746788543075.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/27912i6FFD8BDC32C050B7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="andykrk_1-1746788543075.png" alt="andykrk_1-1746788543075.png" /&gt;&lt;/span&gt;&lt;BR /&gt;For reference we want error_count = 9 for each of those start and end dates:&lt;BR /&gt;05/05/2025 - 06/05/2025&lt;BR /&gt;06/05/2025 - 07/05/2025&lt;BR /&gt;(this can also be simply day date)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried multiple other methods but in the end I get mostly the same problems. Some of the commands I wanted to use like expand datapoints or arrayZip were unfortunately throwing error.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Any suggestions how to break it down the needed way?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 09 May 2025 11:07:30 GMT</pubDate>
    <dc:creator>andykrk</dc:creator>
    <dc:date>2025-05-09T11:07:30Z</dc:date>
    <item>
      <title>Aggregation of data from custom metric</title>
      <link>https://community.dynatrace.com/t5/DQL/Aggregation-of-data-from-custom-metric/m-p/276820#M2045</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am currently working on a Dashboard element that requires me to show error data coming from custom AWS metric. Basic DQL query in the Notebook:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;timeseries sum(`my_custom_aws_metric`),
  interval: 1d,
  from: "2025-05-05",
  by: {aws.account.id, app_name, db_name, table_name},
  filter: { matchesValue(aws.account.id, { “1234” })}
| fieldsAdd error_count = arraySum(`sum(\`my_custom_aws_metric\`)`) 
| fieldsKeep timeframe, app_name, db_name, table_name, aws.account.id, error_count
| filterOut error_count == 0&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;produces the following output:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="andykrk_0-1746788124121.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/27911i9621895858DFFD43/image-size/medium?v=v2&amp;amp;px=400" role="button" title="andykrk_0-1746788124121.png" alt="andykrk_0-1746788124121.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I am trying to breakdown the timeframe and aggregation into daily chunks. I have tested multiple ways like for example:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;timeseries {
  error_count   = sum(`my_custom_aws_metric`),  
  bucket_start  = start(),           
  bucket_end    = end()              
},
interval: 1d,
from: "2025-05-05",
to:   "2025-05-07",                    
by: {
  aws.account.id,
  app_name,
  db_name,
  table_name
},
filter: { aws.account.id == "1234" }   
| expand error_count
| expand bucket_start
| expand bucket_end
| filter   app_name    == “some_app”
| filterOut error_count == 0 or isNull(error_count)
| fieldsRename
    start = bucket_start,
    end   = bucket_end
| fieldsKeep start, end, error_count,
             aws.account.id, app_name, db_name, table_name
| sort      start asc&lt;/LI-CODE&gt;&lt;P&gt;but it produced overlapping time intervals (I guess because of multiple expand commands) and also presented total error count from the whole period for each line:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="andykrk_1-1746788543075.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/27912i6FFD8BDC32C050B7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="andykrk_1-1746788543075.png" alt="andykrk_1-1746788543075.png" /&gt;&lt;/span&gt;&lt;BR /&gt;For reference we want error_count = 9 for each of those start and end dates:&lt;BR /&gt;05/05/2025 - 06/05/2025&lt;BR /&gt;06/05/2025 - 07/05/2025&lt;BR /&gt;(this can also be simply day date)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried multiple other methods but in the end I get mostly the same problems. Some of the commands I wanted to use like expand datapoints or arrayZip were unfortunately throwing error.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Any suggestions how to break it down the needed way?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 May 2025 11:07:30 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Aggregation-of-data-from-custom-metric/m-p/276820#M2045</guid>
      <dc:creator>andykrk</dc:creator>
      <dc:date>2025-05-09T11:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregation of data from custom metric</title>
      <link>https://community.dynatrace.com/t5/DQL/Aggregation-of-data-from-custom-metric/m-p/276980#M2057</link>
      <description>&lt;P&gt;See if &lt;A href="https://community.dynatrace.com/t5/DQL/Pro-Tip-DQL-Query-Snippets-Collection/m-p/270741/highlight/true#M1737" target="_self"&gt;this DQL snippet&lt;/A&gt; helps.&lt;/P&gt;</description>
      <pubDate>Mon, 12 May 2025 21:53:35 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Aggregation-of-data-from-custom-metric/m-p/276980#M2057</guid>
      <dc:creator>marco_irmer</dc:creator>
      <dc:date>2025-05-12T21:53:35Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregation of data from custom metric</title>
      <link>https://community.dynatrace.com/t5/DQL/Aggregation-of-data-from-custom-metric/m-p/277029#M2061</link>
      <description>&lt;P&gt;Thank you very much, Marco! After some adaptation, this solution works great for me.&lt;/P&gt;</description>
      <pubDate>Tue, 13 May 2025 11:17:18 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Aggregation-of-data-from-custom-metric/m-p/277029#M2061</guid>
      <dc:creator>andykrk</dc:creator>
      <dc:date>2025-05-13T11:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: Aggregation of data from custom metric</title>
      <link>https://community.dynatrace.com/t5/DQL/Aggregation-of-data-from-custom-metric/m-p/277282#M2087</link>
      <description>&lt;P&gt;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/19769"&gt;@marco_irmer&lt;/a&gt;&amp;nbsp;I have one additional question. Currently one of the apps that I have (there is couple dozens of them) is running 2 times a day so we are adding up errors within the interval. Is it possible to pick the latest occurrence within the interval in case there is more than one? I think the timestamp is not explicitly listed as part of the metric but perhaps when we get the metric the time is passed automatically.&lt;/P&gt;</description>
      <pubDate>Thu, 15 May 2025 10:04:09 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Aggregation-of-data-from-custom-metric/m-p/277282#M2087</guid>
      <dc:creator>andykrk</dc:creator>
      <dc:date>2025-05-15T10:04:09Z</dc:date>
    </item>
  </channel>
</rss>

