<?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: Group by hours of the day with complete listing of hours in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/Group-by-hours-of-the-day-with-complete-listing-of-hours/m-p/270263#M1722</link>
    <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/38283"&gt;@sinisa_zubic&lt;/a&gt;&amp;nbsp;for your assistance. Have tested the DQL and the results include&amp;nbsp;&lt;SPAN&gt;all hours of the day (00-23), including entries with zero logs - much appreciated and a great solution!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Of note, when presenting this in a &lt;EM&gt;Table&lt;/EM&gt; visualization we see all hours of the day, however if we change the presentation to&amp;nbsp;&lt;EM&gt;Categorical&lt;/EM&gt; (bar layout), the zero entry periods are hidden - included a visual below for reference. To overcome this, we set the count default (0.01) with rounding.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KA_0-1739835814047.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/26460i51B1C0815AB0D109/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KA_0-1739835814047.png" alt="KA_0-1739835814047.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Below is an alternative approach we found via a Community thread, however when presenting&amp;nbsp;&lt;SPAN&gt;&lt;EM&gt;Categorical &lt;/EM&gt;the x-axis label included the current date i.e. Feb 18 ... pref. your provided solution&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| fieldsAdd timestamp = start_time - start_time@d + @d

// group by hour + set default for zero entries
| makeTimeseries count = count(default: 0), from: @d, to: @d+1d, interval: 1h&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 18 Feb 2025 00:24:00 GMT</pubDate>
    <dc:creator>KA</dc:creator>
    <dc:date>2025-02-18T00:24:00Z</dc:date>
    <item>
      <title>Group by hours of the day with complete listing of hours</title>
      <link>https://community.dynatrace.com/t5/DQL/Group-by-hours-of-the-day-with-complete-listing-of-hours/m-p/270176#M1713</link>
      <description>&lt;P&gt;Hi Dynatrace Community,&lt;/P&gt;&lt;P&gt;Seeking some guidance on a DQL that presently fetches data for the past 28 days and groups by hours of the day which shows us the peak usage hours for our web application for a period of time. This works well however there are gaps in the hours of the day (no usage) which results from periods that has zero entries.&lt;/P&gt;&lt;P&gt;We want to ensure that all hours of the day (00-23) are included, even if they have zero entries. &amp;nbsp;Below is the DQL and feel perhaps we should look&amp;nbsp;utilise &lt;EM&gt;maketimeseries&lt;/EM&gt; instead. #stilllearning&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;fetch spans, from: now() - 28d, to: now() - 1d
	| fieldsAdd hourOfDay = formatTimestamp(start_time, format: "HH")
	| summarize count = count(), by: { hourOfDay }    
	| sort hourOfDay asc
	| fields hourOfDay, count&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Feb 2025 03:39:03 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Group-by-hours-of-the-day-with-complete-listing-of-hours/m-p/270176#M1713</guid>
      <dc:creator>KA</dc:creator>
      <dc:date>2025-02-17T03:39:03Z</dc:date>
    </item>
    <item>
      <title>Re: Group by hours of the day with complete listing of hours</title>
      <link>https://community.dynatrace.com/t5/DQL/Group-by-hours-of-the-day-with-complete-listing-of-hours/m-p/270219#M1716</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/86308"&gt;@KA&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;yes you should go the makeTimeseries way.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What do you think about this query&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;fetch spans, from: -28d
| makeTimeseries { count = count(), start = start() }, interval:1h
| fields count = record(count = count[], timestamp = start[])
| expand count
| fields count = count[count], timestamp = formatTimestamp(count[timestamp], format: "HH")
| summarize { count = sum(count)}, by: { timestamp }
| sort timestamp asc&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;BR /&gt;Sini&lt;/P&gt;</description>
      <pubDate>Mon, 17 Feb 2025 12:54:00 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Group-by-hours-of-the-day-with-complete-listing-of-hours/m-p/270219#M1716</guid>
      <dc:creator>sinisa_zubic</dc:creator>
      <dc:date>2025-02-17T12:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: Group by hours of the day with complete listing of hours</title>
      <link>https://community.dynatrace.com/t5/DQL/Group-by-hours-of-the-day-with-complete-listing-of-hours/m-p/270263#M1722</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/38283"&gt;@sinisa_zubic&lt;/a&gt;&amp;nbsp;for your assistance. Have tested the DQL and the results include&amp;nbsp;&lt;SPAN&gt;all hours of the day (00-23), including entries with zero logs - much appreciated and a great solution!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Of note, when presenting this in a &lt;EM&gt;Table&lt;/EM&gt; visualization we see all hours of the day, however if we change the presentation to&amp;nbsp;&lt;EM&gt;Categorical&lt;/EM&gt; (bar layout), the zero entry periods are hidden - included a visual below for reference. To overcome this, we set the count default (0.01) with rounding.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KA_0-1739835814047.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/26460i51B1C0815AB0D109/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KA_0-1739835814047.png" alt="KA_0-1739835814047.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Below is an alternative approach we found via a Community thread, however when presenting&amp;nbsp;&lt;SPAN&gt;&lt;EM&gt;Categorical &lt;/EM&gt;the x-axis label included the current date i.e. Feb 18 ... pref. your provided solution&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| fieldsAdd timestamp = start_time - start_time@d + @d

// group by hour + set default for zero entries
| makeTimeseries count = count(default: 0), from: @d, to: @d+1d, interval: 1h&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2025 00:24:00 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Group-by-hours-of-the-day-with-complete-listing-of-hours/m-p/270263#M1722</guid>
      <dc:creator>KA</dc:creator>
      <dc:date>2025-02-18T00:24:00Z</dc:date>
    </item>
  </channel>
</rss>

