<?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: Difference average and mean in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Difference-average-and-mean/m-p/111536#M29224</link>
    <description>&lt;P&gt;There is indeed no difference between the two, however I've noticed that Splunk only spits out results for one of them when they are averaging the same field. (Which makes sense, since why do twice the work for the same result). For example this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|noop | stats count | fields | eval value=mvrange(1,10) | mvexpand value | eval val2 = value | stats avg(val2) mean(value)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Spits our values for both but this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|noop | stats count | fields | eval value=mvrange(1,10) | mvexpand value | stats avg(value) mean(value)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Spits out a value for only one of them&lt;/P&gt;</description>
    <pubDate>Thu, 09 Jul 2015 13:54:26 GMT</pubDate>
    <dc:creator>acharlieh</dc:creator>
    <dc:date>2015-07-09T13:54:26Z</dc:date>
    <item>
      <title>Difference average and mean</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Difference-average-and-mean/m-p/111535#M29223</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;as I can see in the Splunk docs, using | stats avg() and mean() shoud both give me the same results (arithmetic mean).&lt;/P&gt;

&lt;P&gt;In my query I search for both of avg and mean. But I  am only getting results for mean, not for average.&lt;BR /&gt;
My search query is like this |index=x searchtype=x| stats avg() mean() &lt;/P&gt;

&lt;P&gt;Why are there no results for average? Does average only work if Splunk automatically aggregates values for example to create the average of 5 min chunks? And mean takes all values and divides it by the total count?&lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;

&lt;P&gt;Silvia &lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2015 13:21:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Difference-average-and-mean/m-p/111535#M29223</guid>
      <dc:creator>SilviaGebel</dc:creator>
      <dc:date>2015-07-09T13:21:05Z</dc:date>
    </item>
    <item>
      <title>Re: Difference average and mean</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Difference-average-and-mean/m-p/111536#M29224</link>
      <description>&lt;P&gt;There is indeed no difference between the two, however I've noticed that Splunk only spits out results for one of them when they are averaging the same field. (Which makes sense, since why do twice the work for the same result). For example this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|noop | stats count | fields | eval value=mvrange(1,10) | mvexpand value | eval val2 = value | stats avg(val2) mean(value)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Spits our values for both but this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|noop | stats count | fields | eval value=mvrange(1,10) | mvexpand value | stats avg(value) mean(value)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Spits out a value for only one of them&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2015 13:54:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Difference-average-and-mean/m-p/111536#M29224</guid>
      <dc:creator>acharlieh</dc:creator>
      <dc:date>2015-07-09T13:54:26Z</dc:date>
    </item>
    <item>
      <title>Re: Difference average and mean</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Difference-average-and-mean/m-p/111537#M29225</link>
      <description>&lt;P&gt;Is that your actual search?  If so, the problem is that you need to tell Splunk what &lt;CODE&gt;field&lt;/CODE&gt; to average by putting something inside the parentheses like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=x sourcetype=x| stats avg(x) mean(x)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have NEVER seen avg not work and I use it almost every day!  If you are putting a &lt;CODE&gt;field&lt;/CODE&gt; inside &lt;CODE&gt;avg()&lt;/CODE&gt; then the answer is that the field you are telling Splunk to &lt;CODE&gt;avg&lt;/CODE&gt; does not have any values for the search you are using.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2015 13:55:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Difference-average-and-mean/m-p/111537#M29225</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-07-09T13:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: Difference average and mean</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Difference-average-and-mean/m-p/111538#M29226</link>
      <description>&lt;P&gt;Oh - thank you. That makes sense. &lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2015 14:10:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Difference-average-and-mean/m-p/111538#M29226</guid>
      <dc:creator>SilviaGebel</dc:creator>
      <dc:date>2015-07-09T14:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: Difference average and mean</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Difference-average-and-mean/m-p/111539#M29227</link>
      <description>&lt;P&gt;This isn't the problem. &lt;CODE&gt;| stats avg&lt;/CODE&gt; is the same as &lt;CODE&gt;| stats avg(*)&lt;/CODE&gt; which is spit out averages of all numeric fields. Example search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|noop | stats count | fields | eval value=mvrange(1,10) | mvexpand value | eval val2=value | stats avg
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Jul 2015 14:13:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Difference-average-and-mean/m-p/111539#M29227</guid>
      <dc:creator>acharlieh</dc:creator>
      <dc:date>2015-07-09T14:13:59Z</dc:date>
    </item>
  </channel>
</rss>

