<?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 How to create a search that finds the average of the last three bins? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-that-finds-the-average-of-the-last-three/m-p/592540#M206236</link>
    <description>&lt;P&gt;I have an search where I need to find the average of the last three bins. Example: On my time filter I select an range of 10:00 - 10:30. I need to find the average of ONLY the first three bins 581, 698, and 247. How can I create a search that does this?&lt;/P&gt;
&lt;P&gt;On this dashboard I use an time picker so the search would need to be dynamic, as there would be new time inputs.&lt;/P&gt;
&lt;TABLE border="0" width="128" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="64" height="19"&gt;_time&lt;/TD&gt;
&lt;TD width="64"&gt;Count&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;10:00&lt;/TD&gt;
&lt;TD&gt;581&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;10:05&lt;/TD&gt;
&lt;TD&gt;698&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;10:10&lt;/TD&gt;
&lt;TD&gt;247&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;10:15&lt;/TD&gt;
&lt;TD&gt;987&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;10:20&lt;/TD&gt;
&lt;TD&gt;365&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;10:30&lt;/TD&gt;
&lt;TD&gt;875&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
    <pubDate>Tue, 05 Apr 2022 21:55:29 GMT</pubDate>
    <dc:creator>kishan2356</dc:creator>
    <dc:date>2022-04-05T21:55:29Z</dc:date>
    <item>
      <title>How to create a search that finds the average of the last three bins?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-that-finds-the-average-of-the-last-three/m-p/592540#M206236</link>
      <description>&lt;P&gt;I have an search where I need to find the average of the last three bins. Example: On my time filter I select an range of 10:00 - 10:30. I need to find the average of ONLY the first three bins 581, 698, and 247. How can I create a search that does this?&lt;/P&gt;
&lt;P&gt;On this dashboard I use an time picker so the search would need to be dynamic, as there would be new time inputs.&lt;/P&gt;
&lt;TABLE border="0" width="128" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="64" height="19"&gt;_time&lt;/TD&gt;
&lt;TD width="64"&gt;Count&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;10:00&lt;/TD&gt;
&lt;TD&gt;581&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;10:05&lt;/TD&gt;
&lt;TD&gt;698&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;10:10&lt;/TD&gt;
&lt;TD&gt;247&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;10:15&lt;/TD&gt;
&lt;TD&gt;987&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;10:20&lt;/TD&gt;
&lt;TD&gt;365&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="19"&gt;10:30&lt;/TD&gt;
&lt;TD&gt;875&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Tue, 05 Apr 2022 21:55:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-that-finds-the-average-of-the-last-three/m-p/592540#M206236</guid>
      <dc:creator>kishan2356</dc:creator>
      <dc:date>2022-04-05T21:55:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a search that finds the average of the last three bins?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-that-finds-the-average-of-the-last-three/m-p/592542#M206238</link>
      <description>&lt;P&gt;How do you want to display that, as a single value somewhere or in the same table as your example. There are several ways to calculate that. Note that you mention both first and last - but imply earliest in your numbers.&lt;/P&gt;&lt;P&gt;Note that you can always make a base search if you have data in one dashboard panel that is used by another and add whatever you need to a post processing search for the average.&lt;/P&gt;&lt;P&gt;If you simply want the average of the 3 as a value somewhere, take the last two lines of this.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="_time	Count
10:00	581
10:05	698
10:10	247
10:15	987
10:20	365
10:30	875"
| multikv forceheader=1
| eval _time=strptime(time, "%H:%M")
| table _time Count
| head 3
| stats avg(Count) as Count&lt;/LI-CODE&gt;&lt;P&gt;or as a rolling average of the 3 bins, use this instead of the last two lines above&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| streamstats window=3 avg(Count) as AvgCount&lt;/LI-CODE&gt;&lt;P&gt;If that doesn't help, please clarify how you want to use this value&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2022 23:31:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-that-finds-the-average-of-the-last-three/m-p/592542#M206238</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2022-04-05T23:31:07Z</dc:date>
    </item>
  </channel>
</rss>

