<?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 DQL - timeseries on a dashboard with different timeseries data being shown depending on variable selection in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/DQL-timeseries-on-a-dashboard-with-different-timeseries-data/m-p/281864#M2341</link>
    <description>&lt;P&gt;Hello, I am having issues with a Dashboard / DQL query.&lt;/P&gt;
&lt;P&gt;I have a variable on my dashboard called $Measurement and depending on what that shows I either want to see timeseries data for P90 or Average on my graph.&amp;nbsp; I have tried the below:&lt;/P&gt;
&lt;P&gt;timeseries&lt;BR /&gt;value.Avg = percentile(dt.service.request.response_time, 50, default:0), interval:10m, nonempty:true,&lt;BR /&gt;value.P90 = percentile(dt.service.request.response_time, 90, default:0),&lt;BR /&gt;by: { dt.entity.service },&lt;BR /&gt;from: now()-1d,&lt;BR /&gt;to: now()&lt;BR /&gt;| fieldsAdd ServiceName = entityName(dt.entity.service)&lt;BR /&gt;| fieldsAdd Data = if($Measurement=="Average", value.Avg, else: value.P90)&lt;BR /&gt;| fieldsKeep timeframe, interval, Data, ServiceName&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which gives me charting, but the numbers are wrong, as in it doesn't seem to know that Data is nanoseconds, so it plots it as M instead of the usual default S. I have tried making the value.Avg in to seconds as it is assigned to Data, but that does not work, as I am guessing that it is the default data type of Data hasn't taken on the timeseries format.&lt;/P&gt;
&lt;P&gt;Any ideas please?&lt;/P&gt;
&lt;P&gt;Or maybe I am going about this the wrong way entirely!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have shown how the data plots on the graphs, if I do the value.Avg and value.P90 it is the bottom chart, if I just do the Data, it is the top one&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Screenshot 2025-07-18 171931.gif" style="width: 513px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/29104i6C125F3F35BE94CE/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2025-07-18 171931.gif" alt="Screenshot 2025-07-18 171931.gif" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 21 Jul 2025 13:59:50 GMT</pubDate>
    <dc:creator>CSBee</dc:creator>
    <dc:date>2025-07-21T13:59:50Z</dc:date>
    <item>
      <title>DQL - timeseries on a dashboard with different timeseries data being shown depending on variable selection</title>
      <link>https://community.dynatrace.com/t5/DQL/DQL-timeseries-on-a-dashboard-with-different-timeseries-data/m-p/281864#M2341</link>
      <description>&lt;P&gt;Hello, I am having issues with a Dashboard / DQL query.&lt;/P&gt;
&lt;P&gt;I have a variable on my dashboard called $Measurement and depending on what that shows I either want to see timeseries data for P90 or Average on my graph.&amp;nbsp; I have tried the below:&lt;/P&gt;
&lt;P&gt;timeseries&lt;BR /&gt;value.Avg = percentile(dt.service.request.response_time, 50, default:0), interval:10m, nonempty:true,&lt;BR /&gt;value.P90 = percentile(dt.service.request.response_time, 90, default:0),&lt;BR /&gt;by: { dt.entity.service },&lt;BR /&gt;from: now()-1d,&lt;BR /&gt;to: now()&lt;BR /&gt;| fieldsAdd ServiceName = entityName(dt.entity.service)&lt;BR /&gt;| fieldsAdd Data = if($Measurement=="Average", value.Avg, else: value.P90)&lt;BR /&gt;| fieldsKeep timeframe, interval, Data, ServiceName&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which gives me charting, but the numbers are wrong, as in it doesn't seem to know that Data is nanoseconds, so it plots it as M instead of the usual default S. I have tried making the value.Avg in to seconds as it is assigned to Data, but that does not work, as I am guessing that it is the default data type of Data hasn't taken on the timeseries format.&lt;/P&gt;
&lt;P&gt;Any ideas please?&lt;/P&gt;
&lt;P&gt;Or maybe I am going about this the wrong way entirely!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have shown how the data plots on the graphs, if I do the value.Avg and value.P90 it is the bottom chart, if I just do the Data, it is the top one&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Screenshot 2025-07-18 171931.gif" style="width: 513px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/29104i6C125F3F35BE94CE/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2025-07-18 171931.gif" alt="Screenshot 2025-07-18 171931.gif" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jul 2025 13:59:50 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/DQL-timeseries-on-a-dashboard-with-different-timeseries-data/m-p/281864#M2341</guid>
      <dc:creator>CSBee</dc:creator>
      <dc:date>2025-07-21T13:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: DQL - timeseries on a dashboard with different timeseries data being shown depending on variable selection</title>
      <link>https://community.dynatrace.com/t5/DQL/DQL-timeseries-on-a-dashboard-with-different-timeseries-data/m-p/281960#M2346</link>
      <description>&lt;P&gt;I believe you are running into this issue because the fieldsAdd command is not keeping the data formatting. There's an opportunity here to use the variable directly with a fieldsKeep command to control which fields are retained.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For illustrative purposes, let us start with a variable called $series, with values of 'median' and 'p90'.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="marco_irmer_0-1753124559839.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/29106i56DF75A1CABCE44C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="marco_irmer_0-1753124559839.png" alt="marco_irmer_0-1753124559839.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The next step is to alter our DQL query slightly, so that the series names match the variable values. Once this is done, we can substitute the variable value right in the fieldsKeep command, resulting in the following DQL:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;timeseries
p50 = percentile(dt.service.request.response_time, 50, default:0), interval:10m, nonempty:true,
p90 = percentile(dt.service.request.response_time, 90, default:0),
by: { dt.entity.service },
from: now()-1d,
to: now()
| fieldsAdd ServiceName = entityName(dt.entity.service)
| fieldsKeep timeframe, interval, ServiceName, $series&lt;/LI-CODE&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jul 2025 19:04:01 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/DQL-timeseries-on-a-dashboard-with-different-timeseries-data/m-p/281960#M2346</guid>
      <dc:creator>marco_irmer</dc:creator>
      <dc:date>2025-07-21T19:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: DQL - timeseries on a dashboard with different timeseries data being shown depending on variable selection</title>
      <link>https://community.dynatrace.com/t5/DQL/DQL-timeseries-on-a-dashboard-with-different-timeseries-data/m-p/282008#M2353</link>
      <description>&lt;P&gt;Thank you so much, that works perfectly&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jul 2025 08:27:51 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/DQL-timeseries-on-a-dashboard-with-different-timeseries-data/m-p/282008#M2353</guid>
      <dc:creator>csb</dc:creator>
      <dc:date>2025-07-22T08:27:51Z</dc:date>
    </item>
  </channel>
</rss>

