<?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 Timeseries dt.availability.state split by hours - business non business in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/Timeseries-dt-availability-state-split-by-hours-business-non/m-p/250833#M1058</link>
    <description>&lt;P&gt;Hi All&lt;/P&gt;
&lt;P&gt;I am successfully able to calculate an overall monthly Availability % which aligns to the value show in Host Classic for availability for a given host&lt;/P&gt;
&lt;P&gt;Here is the DQL:&lt;/P&gt;
&lt;P&gt;timeseries {AvailabilityStateUP=sum(dt.host.availability),end()}, filter:availability.state == "up"&lt;BR /&gt;, by: {dt.entity.host,availability.state},interval:1h&lt;BR /&gt;| expand `end()`&lt;BR /&gt;| filter dt.entity.host == "HOST-xxx"&lt;BR /&gt;| fieldsAdd hour = formatTimestamp(`end()`, format:"HH")&lt;BR /&gt;| sort `end()`&lt;/P&gt;
&lt;P&gt;| ... rest of DQL statements for Availability Percentage Calculation and output fields&lt;/P&gt;
&lt;P&gt;I would like to be able to report on Monthly availability percentage split by Business (06h00-18h00) and Non Business Hours (18h00-06h00) - ideally split at the "timeseries" level&lt;/P&gt;
&lt;P&gt;In the screenshot below you can see that "AvailabilityStateUP" contains the array for the WHOLE reporting interval - in this case the last 24 hours - not split by "end()" -&amp;nbsp;&amp;nbsp;&amp;nbsp;I can filter by "hour" after the timeries extraction but it does not help as the array contains all values for the whole reporting period&lt;/P&gt;
&lt;P&gt;The problem is the availability figure for each hour will be the availability % calculation of the WHOLE array for the reporting period&lt;/P&gt;
&lt;P&gt;I thought I could split by: end() but this is also not possible&lt;/P&gt;
&lt;P&gt;I also looked at "bins:" but the documentation did not help me - is this an option? can someone assit with the syntax as per my requirement&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AlanFoley_1-1721196206198.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/21194i33B1CB0E5DCEC2D2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AlanFoley_1-1721196206198.png" alt="AlanFoley_1-1721196206198.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Any other ides? Apprecaite any assistance&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Alan&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Jul 2024 06:37:06 GMT</pubDate>
    <dc:creator>AlanFoley</dc:creator>
    <dc:date>2024-07-17T06:37:06Z</dc:date>
    <item>
      <title>Timeseries dt.availability.state split by hours - business non business</title>
      <link>https://community.dynatrace.com/t5/DQL/Timeseries-dt-availability-state-split-by-hours-business-non/m-p/250833#M1058</link>
      <description>&lt;P&gt;Hi All&lt;/P&gt;
&lt;P&gt;I am successfully able to calculate an overall monthly Availability % which aligns to the value show in Host Classic for availability for a given host&lt;/P&gt;
&lt;P&gt;Here is the DQL:&lt;/P&gt;
&lt;P&gt;timeseries {AvailabilityStateUP=sum(dt.host.availability),end()}, filter:availability.state == "up"&lt;BR /&gt;, by: {dt.entity.host,availability.state},interval:1h&lt;BR /&gt;| expand `end()`&lt;BR /&gt;| filter dt.entity.host == "HOST-xxx"&lt;BR /&gt;| fieldsAdd hour = formatTimestamp(`end()`, format:"HH")&lt;BR /&gt;| sort `end()`&lt;/P&gt;
&lt;P&gt;| ... rest of DQL statements for Availability Percentage Calculation and output fields&lt;/P&gt;
&lt;P&gt;I would like to be able to report on Monthly availability percentage split by Business (06h00-18h00) and Non Business Hours (18h00-06h00) - ideally split at the "timeseries" level&lt;/P&gt;
&lt;P&gt;In the screenshot below you can see that "AvailabilityStateUP" contains the array for the WHOLE reporting interval - in this case the last 24 hours - not split by "end()" -&amp;nbsp;&amp;nbsp;&amp;nbsp;I can filter by "hour" after the timeries extraction but it does not help as the array contains all values for the whole reporting period&lt;/P&gt;
&lt;P&gt;The problem is the availability figure for each hour will be the availability % calculation of the WHOLE array for the reporting period&lt;/P&gt;
&lt;P&gt;I thought I could split by: end() but this is also not possible&lt;/P&gt;
&lt;P&gt;I also looked at "bins:" but the documentation did not help me - is this an option? can someone assit with the syntax as per my requirement&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AlanFoley_1-1721196206198.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/21194i33B1CB0E5DCEC2D2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AlanFoley_1-1721196206198.png" alt="AlanFoley_1-1721196206198.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Any other ides? Apprecaite any assistance&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Alan&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jul 2024 06:37:06 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Timeseries-dt-availability-state-split-by-hours-business-non/m-p/250833#M1058</guid>
      <dc:creator>AlanFoley</dc:creator>
      <dc:date>2024-07-17T06:37:06Z</dc:date>
    </item>
    <item>
      <title>Re: Timeseries dt.availability.state split by hours - business non business</title>
      <link>https://community.dynatrace.com/t5/DQL/Timeseries-dt-availability-state-split-by-hours-business-non/m-p/250854#M1061</link>
      <description>&lt;P&gt;You do not need to expand. You can use iterative expressions:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;timeseries {AvailabilityStateUP=sum(dt.host.availability),e=end()}, filter:availability.state == "up" and dt.entity.host == "HOST-000CA78B479207CD"
, by: {dt.entity.host,availability.state},interval:1h
| fieldsAdd AvailabilityStateUP_BH = if( getHour(e[])&amp;gt;=8 and getHour(e[])&amp;lt;=17, AvailabilityStateUP[] )
| fieldsAdd AvailabilityStateUP_NBH = if( getHour(e[])&amp;lt;8 or getHour(e[])&amp;gt;17, AvailabilityStateUP[] )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;this way you get 2 timeseries, each one filled only values in our outside business hours. Then you can proceed with summarization of the array using array functions.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="krzysztof_hoja_1-1721212267538.png" style="width: 841px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/21197iD417D0C0DFF7C1FE/image-dimensions/841x227?v=v2" width="841" height="227" role="button" title="krzysztof_hoja_1-1721212267538.png" alt="krzysztof_hoja_1-1721212267538.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is possible with expand too, but you need to construct single array of records containing both: availability metric and time:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;timeseries {AvailabilityStateUP=sum(dt.host.availability),e=end()}, filter:availability.state == "up" and dt.entity.host == "HOST-000CA78B479207CD"
, by: {dt.entity.host,availability.state},interval:1h
| fieldsAdd AvailabilityStateUPWithH = record(av=AvailabilityStateUP[], h=getHour(e[]))
| expand AvailabilityStateUPWithH
| fieldsFlatten AvailabilityStateUPWithH&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="krzysztof_hoja_0-1721212219589.png" style="width: 839px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/21196i3D6DE3F947988F6B/image-dimensions/839x407?v=v2" width="839" height="407" role="button" title="krzysztof_hoja_0-1721212219589.png" alt="krzysztof_hoja_0-1721212219589.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jul 2024 10:31:53 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Timeseries-dt-availability-state-split-by-hours-business-non/m-p/250854#M1061</guid>
      <dc:creator>krzysztof_hoja</dc:creator>
      <dc:date>2024-07-17T10:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: Timeseries dt.availability.state split by hours - business non business</title>
      <link>https://community.dynatrace.com/t5/DQL/Timeseries-dt-availability-state-split-by-hours-business-non/m-p/250864#M1062</link>
      <description>&lt;P&gt;Hi&amp;nbsp;krzysztof_hoja&lt;/P&gt;&lt;P&gt;The&amp;nbsp;&lt;SPAN&gt;iterative expressions solution is perfect - works like a charm&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Really appreciate you taking the time to test and provide a solution&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks a mil&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Alan&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jul 2024 13:07:27 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Timeseries-dt-availability-state-split-by-hours-business-non/m-p/250864#M1062</guid>
      <dc:creator>AlanFoley</dc:creator>
      <dc:date>2024-07-17T13:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: Timeseries dt.availability.state split by hours - business non business</title>
      <link>https://community.dynatrace.com/t5/DQL/Timeseries-dt-availability-state-split-by-hours-business-non/m-p/288404#M2696</link>
      <description>&lt;P&gt;Have been struggling with this for a while now!!&lt;BR /&gt;Thank you so much!&lt;/P&gt;</description>
      <pubDate>Thu, 23 Oct 2025 16:53:43 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Timeseries-dt-availability-state-split-by-hours-business-non/m-p/288404#M2696</guid>
      <dc:creator>PedroDeodato</dc:creator>
      <dc:date>2025-10-23T16:53:43Z</dc:date>
    </item>
  </channel>
</rss>

