<?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: Handling Metric Definition Changes in a Single DQL Timeseries in Dynatrace tips</title>
    <link>https://community.dynatrace.com/t5/Dynatrace-tips/Handling-Metric-Definition-Changes-in-a-Single-DQL-Timeseries/m-p/299066#M1905</link>
    <description>&lt;P&gt;Thank you!&amp;nbsp;&lt;img class="lia-deferred-image lia-image-emoji" src="https://community.dynatrace.com/html/@9BD876A77FEF3D5EF4BC972CF8A97CB1/images/emoticons/take_my_money.png" alt=":take_my_money:" title=":take_my_money:" /&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 05 May 2026 16:04:41 GMT</pubDate>
    <dc:creator>AntonPineiro</dc:creator>
    <dc:date>2026-05-05T16:04:41Z</dc:date>
    <item>
      <title>Handling Metric Definition Changes in a Single DQL Timeseries</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-tips/Handling-Metric-Definition-Changes-in-a-Single-DQL-Timeseries/m-p/299012#M1904</link>
      <description>&lt;P&gt;Sometimes, the definition of a metric changes over time. For example, an endpoint may initially be measured only by its name, but after a certain date you may need to restrict the calculation to specific services as well.&lt;/P&gt;&lt;P&gt;Instead of creating two separate dashboard tiles or manually changing the query depending on the selected timeframe, you can calculate both versions in the same &lt;STRONG&gt;timeseries &lt;/STRONG&gt;query and then use a timestamp cutover to decide which one should be used for each datapoint.&lt;/P&gt;&lt;H3&gt;The idea&lt;/H3&gt;&lt;P&gt;In this example, the query calculates two versions of the same business metric:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;TotalRequests_Old &lt;/STRONG&gt;and &lt;STRONG&gt;FailedRequests_Old&lt;/STRONG&gt;: used before the cutover date.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;TotalRequests_New&lt;/STRONG&gt; and &lt;STRONG&gt;FailedRequests_New&lt;/STRONG&gt;: used after the cutover date, with additional &lt;STRONG&gt;dt.entity.service&lt;/STRONG&gt; filtering.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;The key part is this:&lt;/P&gt;&lt;PRE&gt;| fieldsAdd TotalRequests =
    if(
        datapointStart[] &amp;lt; toTimestamp("2026-03-31T23:00:00.000+01:00"),
        TotalRequests_Old[],
        else: TotalRequests_New[]
    )

| fieldsAdd FailedRequests =
    if(
        datapointStart[] &amp;lt; toTimestamp("2026-03-31T23:00:00.000+01:00"),
        FailedRequests_Old[],
        else: FailedRequests_New[]
    )&lt;/PRE&gt;&lt;P&gt;This allows the final metric to behave as one continuous calculation, even though the underlying filter logic changes after a specific point in time.&lt;/P&gt;&lt;H3&gt;Why this is useful&lt;/H3&gt;&lt;P&gt;This pattern is especially useful when you need to preserve historical reporting while adapting the query to a new architecture, renamed endpoints, split services, or improved filtering logic.&lt;/P&gt;&lt;P&gt;In this case, the query also limits the calculation to business hours:&lt;/P&gt;&lt;PRE&gt;| fieldsAdd TotalRequests_BH =
    if(
        getHour(datapointStart[], timezone: "CET") &amp;gt;= 9
        and getHour(datapointStart[], timezone: "CET") &amp;lt;= 16,
        TotalRequests[],
        else: null
    )&lt;/PRE&gt;&lt;P&gt;After that, it calculates the success average based only on business-hour traffic:&lt;/P&gt;&lt;PRE&gt;| fieldsAdd SucAvg =
    if(
        somaTotalRequests_BH &amp;gt; 0,
        (somaTotalRequests_BH - somaFailedRequests_BH) / somaTotalRequests_BH * 100,
        else: null
    )&lt;/PRE&gt;&lt;H3&gt;Pro Tip&lt;/H3&gt;&lt;P&gt;When you need to change the logic of a timeseries after a specific date, avoid trying to place &lt;STRONG&gt;start()&lt;/STRONG&gt; directly inside the metric selector filter. Instead, calculate both metric versions first, expose &lt;STRONG&gt;datapointStart = start()&lt;/STRONG&gt;, and then use &lt;STRONG&gt;if()&lt;/STRONG&gt; to select the correct array values after the timeseries is created.&lt;/P&gt;&lt;P&gt;This keeps the visualization clean, avoids duplicated dashboard tiles, and lets you maintain a single historical metric line even when the filtering logic changes over time.&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2026 11:03:06 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-tips/Handling-Metric-Definition-Changes-in-a-Single-DQL-Timeseries/m-p/299012#M1904</guid>
      <dc:creator>MaximilianoML</dc:creator>
      <dc:date>2026-05-05T11:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Metric Definition Changes in a Single DQL Timeseries</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-tips/Handling-Metric-Definition-Changes-in-a-Single-DQL-Timeseries/m-p/299066#M1905</link>
      <description>&lt;P&gt;Thank you!&amp;nbsp;&lt;img class="lia-deferred-image lia-image-emoji" src="https://community.dynatrace.com/html/@9BD876A77FEF3D5EF4BC972CF8A97CB1/images/emoticons/take_my_money.png" alt=":take_my_money:" title=":take_my_money:" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2026 16:04:41 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-tips/Handling-Metric-Definition-Changes-in-a-Single-DQL-Timeseries/m-p/299066#M1905</guid>
      <dc:creator>AntonPineiro</dc:creator>
      <dc:date>2026-05-05T16:04:41Z</dc:date>
    </item>
  </channel>
</rss>

