<?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: How do I compare the average of the first 10 results to the average of the last 10 results and apply a calculation? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-compare-the-average-of-the-first-10-results-to-the/m-p/391596#M114004</link>
    <description>&lt;P&gt;Hi @hyperscaleau&lt;/P&gt;

&lt;P&gt;try like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=.................| streamstats window=10 earliest(SG) as SGStart | stats avg(SGStart) as OG |appendcols [search index=........| streamstats window=10 latest(SG) as SGEnd | stats avg(SGEnd) as FG] | eval stepG = 'OG'-'SG' | eval ABV=stepG*131.25 | table ABV
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 25 Sep 2018 12:51:24 GMT</pubDate>
    <dc:creator>harishalipaka</dc:creator>
    <dc:date>2018-09-25T12:51:24Z</dc:date>
    <item>
      <title>How do I compare the average of the first 10 results to the average of the last 10 results and apply a calculation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-compare-the-average-of-the-first-10-results-to-the/m-p/391595#M114003</link>
      <description>&lt;P&gt;I need to return the average of the earliest 10 results &lt;STRONG&gt;(OG)&lt;/STRONG&gt; in an index and the average of the latest 10 results &lt;STRONG&gt;(FG)&lt;/STRONG&gt; in the same index.  I then need to apply a calculation to get the result &lt;STRONG&gt;(ABV)&lt;/STRONG&gt; -ie:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ABV=[average of earliest 10 results] minus [average of the latest 10 results] multiplied by 131.25
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I can calculate &lt;STRONG&gt;OG&lt;/STRONG&gt; by using this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| streamstats window=10 earliest(SG) as SGStart | stats avg(SGStart) as OG
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And I can calculate &lt;STRONG&gt;FG&lt;/STRONG&gt; by using this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| streamstats window=10 latest(SG) as SGEnd | stats avg(SGEnd) as FG
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And I can also calculate &lt;STRONG&gt;ABV&lt;/STRONG&gt; by appending:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval stepG = 'OG'-'SG' | eval ABV=stepG*131.25 | table ABV
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But obviously some events are lost in the pipeline due to filtering and I can't figure out how to put it all together.&lt;/P&gt;

&lt;P&gt;Any help would be greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Tue, 25 Sep 2018 12:33:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-compare-the-average-of-the-first-10-results-to-the/m-p/391595#M114003</guid>
      <dc:creator>hyperscaleau</dc:creator>
      <dc:date>2018-09-25T12:33:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do I compare the average of the first 10 results to the average of the last 10 results and apply a calculation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-compare-the-average-of-the-first-10-results-to-the/m-p/391596#M114004</link>
      <description>&lt;P&gt;Hi @hyperscaleau&lt;/P&gt;

&lt;P&gt;try like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=.................| streamstats window=10 earliest(SG) as SGStart | stats avg(SGStart) as OG |appendcols [search index=........| streamstats window=10 latest(SG) as SGEnd | stats avg(SGEnd) as FG] | eval stepG = 'OG'-'SG' | eval ABV=stepG*131.25 | table ABV
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Sep 2018 12:51:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-compare-the-average-of-the-first-10-results-to-the/m-p/391596#M114004</guid>
      <dc:creator>harishalipaka</dc:creator>
      <dc:date>2018-09-25T12:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do I compare the average of the first 10 results to the average of the last 10 results and apply a calculation?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-compare-the-average-of-the-first-10-results-to-the/m-p/391597#M114005</link>
      <description>&lt;P&gt;Thanks @harishalipaka You're a star!  Slight correction to due some typos (from my original post) but it works perfectly.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=xyz| streamstats window=10 earliest(SG) as SGStart | stats avg(SGStart) as OG |appendcols [search index=xyz | streamstats window=10 latest(SG) as SGEnd | stats avg(SGEnd) as FG] | eval stepG = 'OG'-'FG'  | eval ABV = 'stepG'*131.25 | table OG,FG,ABV
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Sep 2018 13:17:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-compare-the-average-of-the-first-10-results-to-the/m-p/391597#M114005</guid>
      <dc:creator>hyperscaleau</dc:creator>
      <dc:date>2018-09-25T13:17:15Z</dc:date>
    </item>
  </channel>
</rss>

