<?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: Adding field to time series based on separate record in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/Adding-field-to-time-series-based-on-separate-record/m-p/270398#M1726</link>
    <description>&lt;P&gt;PR1_status is an array so it cannot be used in join condition directly.&lt;/P&gt;&lt;P&gt;I see that you are trying to translate numeric statues into text and the list of possibilities is rather short and static. This could be a query solving it:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;timeseries PR1_status = avg(PR1_status), by: { device }
| fieldsAdd Status=coalesce(
if(PR1_status[]== 0,"Unknown"),
if(PR1_status[]== 1,"Up"),
if(PR1_status[]== 2,"Down"),
if(PR1_status[]== 3,"Warning"),
if(PR1_status[]== 4,"Shutdown"),
if(PR1_status[]== 5,"Testins"),
if(PR1_status[]== 6,"Dormant"),
if(PR1_status[]== 7,"Not Present"),
if(PR1_status[]== 8,"Lower Layer Down"),
if(PR1_status[]== 9,"Unmanaged"),
if(PR1_status[]== 10,"Unplugged"),
if(PR1_status[]== 11,"External"),
if(PR1_status[]== 12,"Unreachable")
)&lt;/LI-CODE&gt;&lt;P&gt;on simulated data it looks like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="krzysztof_hoja_1-1739947124863.png" style="width: 871px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/26497i47052D3069A22982/image-dimensions/871x333?v=v2" width="871" height="333" role="button" title="krzysztof_hoja_1-1739947124863.png" alt="krzysztof_hoja_1-1739947124863.png" /&gt;&lt;/span&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;</description>
    <pubDate>Wed, 19 Feb 2025 06:39:05 GMT</pubDate>
    <dc:creator>krzysztof_hoja</dc:creator>
    <dc:date>2025-02-19T06:39:05Z</dc:date>
    <item>
      <title>Adding field to time series based on separate record</title>
      <link>https://community.dynatrace.com/t5/DQL/Adding-field-to-time-series-based-on-separate-record/m-p/270382#M1725</link>
      <description>&lt;P&gt;I have a time series with statuses from 0-12. I'd like to replace these status numbers with words as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;timeseries PR1_status = avg(PR1_status), by: { device }
| join [
      data record(Status = "Unknown", PR1_status= 0),
record(Status = "Up", PR1_status= 1),
record(Status = "Down", PR1_status= 2),
record(Status = "Warning", PR1_status= 3),
record(Status = "Shutdown", PR1_status= 4),
record(Status = "Testing", PR1_status= 5),
record(Status = "Dormant", PR1_status= 6),
record(Status = "Not Present", PR1_status= 7),
record(Status = "Lower Layer Down", PR1_status= 8),
record(Status = "Unmanaged", PR1_status= 9),
record(Status = "Unplugged", PR1_status= 10),
record(Status = "External", PR1_status= 11),
record(Status = "Unreachable", PR1_status= 12)
    ],
    kind: leftOuter,
    on: { PR1_status}
| fieldsRemove right.PR1_status&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get the following error:&amp;nbsp;&lt;EM&gt;The data types are incompatible. Please change the expressions and try again. Using the `to...` conversion functions could help.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure if join is the best way to go about this but any help would be appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2025 22:47:58 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Adding-field-to-time-series-based-on-separate-record/m-p/270382#M1725</guid>
      <dc:creator>paulito</dc:creator>
      <dc:date>2025-02-18T22:47:58Z</dc:date>
    </item>
    <item>
      <title>Re: Adding field to time series based on separate record</title>
      <link>https://community.dynatrace.com/t5/DQL/Adding-field-to-time-series-based-on-separate-record/m-p/270398#M1726</link>
      <description>&lt;P&gt;PR1_status is an array so it cannot be used in join condition directly.&lt;/P&gt;&lt;P&gt;I see that you are trying to translate numeric statues into text and the list of possibilities is rather short and static. This could be a query solving it:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;timeseries PR1_status = avg(PR1_status), by: { device }
| fieldsAdd Status=coalesce(
if(PR1_status[]== 0,"Unknown"),
if(PR1_status[]== 1,"Up"),
if(PR1_status[]== 2,"Down"),
if(PR1_status[]== 3,"Warning"),
if(PR1_status[]== 4,"Shutdown"),
if(PR1_status[]== 5,"Testins"),
if(PR1_status[]== 6,"Dormant"),
if(PR1_status[]== 7,"Not Present"),
if(PR1_status[]== 8,"Lower Layer Down"),
if(PR1_status[]== 9,"Unmanaged"),
if(PR1_status[]== 10,"Unplugged"),
if(PR1_status[]== 11,"External"),
if(PR1_status[]== 12,"Unreachable")
)&lt;/LI-CODE&gt;&lt;P&gt;on simulated data it looks like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="krzysztof_hoja_1-1739947124863.png" style="width: 871px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/26497i47052D3069A22982/image-dimensions/871x333?v=v2" width="871" height="333" role="button" title="krzysztof_hoja_1-1739947124863.png" alt="krzysztof_hoja_1-1739947124863.png" /&gt;&lt;/span&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;</description>
      <pubDate>Wed, 19 Feb 2025 06:39:05 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Adding-field-to-time-series-based-on-separate-record/m-p/270398#M1726</guid>
      <dc:creator>krzysztof_hoja</dc:creator>
      <dc:date>2025-02-19T06:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: Adding field to time series based on separate record</title>
      <link>https://community.dynatrace.com/t5/DQL/Adding-field-to-time-series-based-on-separate-record/m-p/270450#M1730</link>
      <description>&lt;P&gt;This does work but I'm trying to get the words to show up on a line graph instead of just "1" when a device is up or "2" when it's down. It'd be nice to also get the words on the y axis.&lt;/P&gt;&lt;P&gt;Not sure if this is possible as the data mapping asks for a numeric field.&lt;/P&gt;&lt;P&gt;I've attached an image showing what I'm trying to do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2025 15:55:58 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Adding-field-to-time-series-based-on-separate-record/m-p/270450#M1730</guid>
      <dc:creator>paulito</dc:creator>
      <dc:date>2025-02-19T15:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: Adding field to time series based on separate record</title>
      <link>https://community.dynatrace.com/t5/DQL/Adding-field-to-time-series-based-on-separate-record/m-p/270458#M1731</link>
      <description>&lt;P&gt;Unfortunately this visualization as well as other currently available does not allow it. Line/bar/area chart are designed to display metrics (continuous space of values) and what you are looking for is state tracking over time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is possible to do is e.g. see number of devices in each state for each interval. And in this case each of series would be labeled with word&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2025 17:16:33 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Adding-field-to-time-series-based-on-separate-record/m-p/270458#M1731</guid>
      <dc:creator>krzysztof_hoja</dc:creator>
      <dc:date>2025-02-19T17:16:33Z</dc:date>
    </item>
  </channel>
</rss>

