<?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: Is there a way to display Count per hr for last 24hrs with Average per hr for the last 30 days as an overlay? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-display-Count-per-hr-for-last-24hrs-with/m-p/402693#M116520</link>
    <description>&lt;P&gt;You can use addtotals and eventstats after your timechart command to compute the average of the SalesPerHr field. I suggest adding an index to your search to optimize performance. Here is the syntax you will need&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=your_index_here source=flow_stage*order_header
| timechart span=1h count AS SalesPerHr by WebsiteCountry
| addtotals
| eventstats avg(Total) as average
| fields - total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then on the visualization tab select Format &amp;gt; Chart Overlay and select "average" as your overlay field&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/6584iF9B9322DF6477FE2/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Feb 2019 21:49:09 GMT</pubDate>
    <dc:creator>pkeenan87</dc:creator>
    <dc:date>2019-02-21T21:49:09Z</dc:date>
    <item>
      <title>Is there a way to display Count per hr for last 24hrs with Average per hr for the last 30 days as an overlay?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-display-Count-per-hr-for-last-24hrs-with/m-p/402690#M116517</link>
      <description>&lt;P&gt;Hi Splunk Gurus,&lt;/P&gt;

&lt;P&gt;Hoping someone out there might be able to provide some assistance with this one.&lt;/P&gt;

&lt;P&gt;I have a requirement to be able to display a count of sales per hr for the last 24 hrs (with flexibility to adjust that as needed), but also to show the average sales per hr for the last 30 days as an overlay.&lt;/P&gt;

&lt;P&gt;First bit is easy, second bit has me stumped.  Have spent the last hr going through various posts looking or solutions, but nothing quite right for my situation.&lt;/P&gt;

&lt;P&gt;Initial search would be something like this: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* source=flow_stage*order_header
          | timechart span=1h count AS SalesPerHr by WebsiteCountry
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;giving a graph like this: &lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/6586i830D2584597E770B/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;BR /&gt;
What I need to add is the overlay line that shows the average sales per hr based on the last 30 days sales data.&lt;/P&gt;

&lt;P&gt;Hopefully this is clear - any help gratefully appreciated!&lt;/P&gt;

&lt;P&gt;EDIT:&lt;BR /&gt;
As requested - some sample data (does not contain all fields as some contain sensitive data).&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2019-02-22 07:21:14.823, order_no="AU02051432", nav_order_no="AU02051432", order_date="2019-02-21 20:17:13.0", invoice_no="07324912", customer_no="CA06908192", newsletter_subscription="0", currency="AUD", total_net_price="127.22", total_tax="12.73", total_gross_price="139.95", dw_order_filename="Order_AU02051432.xml", merchandize_total_net_price="115.45", merchandize_total_tax="11.55", merchandize_total_gross_price="127.0", adj_merchandize_total_net_price="115.45", adj_merchandize_total_tax="11.55", adj_merchandize_total_gross_price="127.0", status="0", inserted="2019-02-22 07:21:14.823", updated="2019-02-22 07:22:03.0", status_shipping="NOT_SHIPPED"
2019-02-22 07:01:17.127, order_no="AU02051484", nav_order_no="AU02051484", order_date="2019-02-21 19:51:16.0", invoice_no="07325413", customer_no="CA06908750", newsletter_subscription="0", currency="AUD", total_net_price="83.59", total_tax="8.36", total_gross_price="91.95", dw_order_filename="Order_AU02051484.xml", merchandize_total_net_price="71.82", merchandize_total_tax="7.18", merchandize_total_gross_price="79.0", adj_merchandize_total_net_price="71.82", adj_merchandize_total_tax="7.18", adj_merchandize_total_gross_price="79.0", status="0", inserted="2019-02-22 07:01:17.127", updated="2019-02-22 07:02:04.0", status_shipping="NOT_SHIPPED"
2019-02-22 06:51:13.643, order_no="AU02051483", nav_order_no="AU02051483", order_date="2019-02-21 19:39:23.0", invoice_no="07325412", customer_no="CA06908749", newsletter_subscription="0", currency="AUD", total_net_price="252.72", total_tax="25.28", total_gross_price="278.0", dw_order_filename="Order_AU02051483.xml", merchandize_total_net_price="252.72", merchandize_total_tax="25.28", merchandize_total_gross_price="278.0", adj_merchandize_total_net_price="252.72", adj_merchandize_total_tax="25.28", adj_merchandize_total_gross_price="278.0", status="0", inserted="2019-02-22 06:51:13.643", updated="2019-02-22 06:52:03.0", status_shipping="NOT_SHIPPED"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Feb 2019 03:19:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-display-Count-per-hr-for-last-24hrs-with/m-p/402690#M116517</guid>
      <dc:creator>kozanic_FF</dc:creator>
      <dc:date>2019-02-20T03:19:42Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to display Count per hr for last 24hrs with Average per hr for the last 30 days as an overlay?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-display-Count-per-hr-for-last-24hrs-with/m-p/402691#M116518</link>
      <description>&lt;P&gt;Could you please share some sample events?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Feb 2019 07:03:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-display-Count-per-hr-for-last-24hrs-with/m-p/402691#M116518</guid>
      <dc:creator>p_gurav</dc:creator>
      <dc:date>2019-02-20T07:03:02Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to display Count per hr for last 24hrs with Average per hr for the last 30 days as an overlay?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-display-Count-per-hr-for-last-24hrs-with/m-p/402692#M116519</link>
      <description>&lt;P&gt;So this overlay should be a flat line with average sales per hour for all countries and all hours (single values)??&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 21:20:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-display-Count-per-hr-for-last-24hrs-with/m-p/402692#M116519</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2019-02-21T21:20:28Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to display Count per hr for last 24hrs with Average per hr for the last 30 days as an overlay?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-display-Count-per-hr-for-last-24hrs-with/m-p/402693#M116520</link>
      <description>&lt;P&gt;You can use addtotals and eventstats after your timechart command to compute the average of the SalesPerHr field. I suggest adding an index to your search to optimize performance. Here is the syntax you will need&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=your_index_here source=flow_stage*order_header
| timechart span=1h count AS SalesPerHr by WebsiteCountry
| addtotals
| eventstats avg(Total) as average
| fields - total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then on the visualization tab select Format &amp;gt; Chart Overlay and select "average" as your overlay field&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/6584iF9B9322DF6477FE2/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 21:49:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-display-Count-per-hr-for-last-24hrs-with/m-p/402693#M116520</guid>
      <dc:creator>pkeenan87</dc:creator>
      <dc:date>2019-02-21T21:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to display Count per hr for last 24hrs with Average per hr for the last 30 days as an overlay?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-display-Count-per-hr-for-last-24hrs-with/m-p/402694#M116521</link>
      <description>&lt;P&gt;Hi @somesoni2,&lt;/P&gt;

&lt;P&gt;what I'd like is a moving line that for each hr, shows the average sales for that hr in the last 30 days, based on total sales for that hr.&lt;/P&gt;

&lt;P&gt;The line would go up and down in accordance with hourly average.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 22:03:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-display-Count-per-hr-for-last-24hrs-with/m-p/402694#M116521</guid>
      <dc:creator>kozanic_FF</dc:creator>
      <dc:date>2019-02-21T22:03:52Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to display Count per hr for last 24hrs with Average per hr for the last 30 days as an overlay?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-display-Count-per-hr-for-last-24hrs-with/m-p/402695#M116522</link>
      <description>&lt;P&gt;Hi @pkeenan87, &lt;/P&gt;

&lt;P&gt;Thanks for your response.&lt;/P&gt;

&lt;P&gt;I have tested this but it doesn't work.  In the chart overly area, I get a overlay value of "Null" which when I select only gives me the average line (which is also I'm assuming is also only based on the same period that the report is run for??), no longer shows the bars for each hr.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 22:10:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-display-Count-per-hr-for-last-24hrs-with/m-p/402695#M116522</guid>
      <dc:creator>kozanic_FF</dc:creator>
      <dc:date>2019-02-21T22:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to display Count per hr for last 24hrs with Average per hr for the last 30 days as an overlay?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-display-Count-per-hr-for-last-24hrs-with/m-p/402696#M116523</link>
      <description>&lt;P&gt;@kozanic_FF Whoops, sorry about that. Because you are using timechart we will need to add the totals first before we can compute the average. I have updated my post accordingly&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 22:25:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-display-Count-per-hr-for-last-24hrs-with/m-p/402696#M116523</guid>
      <dc:creator>pkeenan87</dc:creator>
      <dc:date>2019-02-21T22:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to display Count per hr for last 24hrs with Average per hr for the last 30 days as an overlay?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-display-Count-per-hr-for-last-24hrs-with/m-p/402697#M116524</link>
      <description>&lt;P&gt;Thanks @pkeenan87 ,&lt;/P&gt;

&lt;P&gt;A minor tweak - change "- total" to "- NULL" and this works now. &lt;/P&gt;

&lt;P&gt;While this is great if I just wanted to add the sales average for the report range, I need to be able to show the Sales Per Hour Average for the last 30 days on the overly.&lt;/P&gt;

&lt;P&gt;Any thoughts on how I might achieve this?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 22:54:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-display-Count-per-hr-for-last-24hrs-with/m-p/402697#M116524</guid>
      <dc:creator>kozanic_FF</dc:creator>
      <dc:date>2019-02-21T22:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to display Count per hr for last 24hrs with Average per hr for the last 30 days as an overlay?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-display-Count-per-hr-for-last-24hrs-with/m-p/402698#M116525</link>
      <description>&lt;P&gt;Thats a little tricky, give this a try:&lt;/P&gt;

&lt;P&gt;index=your_index_here source=flow_stage*order_header&lt;BR /&gt;
 | timechart span=1h count AS SalesPerHr by WebsiteCountry&lt;BR /&gt;
 | eval date_hour = strftime(_time, "%H")&lt;BR /&gt;
 | join date_hour [&lt;BR /&gt;
    search earliest=-30d index=your_index_here source=flow_stage*order_header&lt;BR /&gt;
    | timechart span=1h count&lt;BR /&gt;
    | eval date_hour = strftime(_time, "%H")&lt;BR /&gt;
    | stats avg(count) as average by date_hour&lt;BR /&gt;
    | eval average = round(average)&lt;BR /&gt;
    | fields date_hour average ]&lt;BR /&gt;
| fields - date_hour&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:20:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-display-Count-per-hr-for-last-24hrs-with/m-p/402698#M116525</guid>
      <dc:creator>pkeenan87</dc:creator>
      <dc:date>2020-09-29T23:20:06Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to display Count per hr for last 24hrs with Average per hr for the last 30 days as an overlay?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-display-Count-per-hr-for-last-24hrs-with/m-p/402699#M116526</link>
      <description>&lt;P&gt;Thanks @pkeenan87, that seems to be exactly what I was after!&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2019 23:41:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-there-a-way-to-display-Count-per-hr-for-last-24hrs-with/m-p/402699#M116526</guid>
      <dc:creator>kozanic_FF</dc:creator>
      <dc:date>2019-02-25T23:41:41Z</dc:date>
    </item>
  </channel>
</rss>

