<?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: Getting a wrong answer for the calculation of mean in splunk in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Getting-a-wrong-answer-for-the-calculation-of-mean-in-splunk/m-p/104087#M183137</link>
    <description>&lt;P&gt;Ahaa.. Got it. I understand it now on why it messed it up. Thanks for the clarification.&lt;/P&gt;</description>
    <pubDate>Fri, 26 Oct 2012 15:58:27 GMT</pubDate>
    <dc:creator>theouhuios</dc:creator>
    <dc:date>2012-10-26T15:58:27Z</dc:date>
    <item>
      <title>Getting a wrong answer for the calculation of mean in splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-a-wrong-answer-for-the-calculation-of-mean-in-splunk/m-p/104085#M183135</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;

&lt;P&gt;I am trying to calculate the mean of a field and it's strange that splunk cal the mean in a completely different manner.&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;week  A   B   mean(B)&lt;BR /&gt;
1   41  1290    0   0.000000&lt;BR /&gt;
2   42  1372    82  82.000000&lt;BR /&gt;
3   43  81  1291    1291.000000&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;As you can see above the value is kind of wrong. The command which I used was &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=incident record.affectedCI="xxxx"| eval week=tonumber(strftime(_time,"%U"))  | stats count by week | rename count as A |delta A as B | eval B=coalesce(B,0) | eval B = abs(B) | stats mean(B) by week A B
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In my understanding of math it should have been (0+82+1291)/3 and it should have been the same value for all the weeks. Can anyone please let me know if I am missing something here. &lt;/P&gt;

&lt;P&gt;Regards&lt;/P&gt;

&lt;P&gt;theou&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2012 15:50:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-a-wrong-answer-for-the-calculation-of-mean-in-splunk/m-p/104085#M183135</guid>
      <dc:creator>theouhuios</dc:creator>
      <dc:date>2012-10-26T15:50:34Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a wrong answer for the calculation of mean in splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-a-wrong-answer-for-the-calculation-of-mean-in-splunk/m-p/104086#M183136</link>
      <description>&lt;P&gt;stats evaluates per-event, grouping by your differentiators (the by-clause). Try eventstats. In this case, an example invocation would be like this (replace the stats command at the end of your search):&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;&lt;BR /&gt;
| eventstats mean(B)&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2012 15:54:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-a-wrong-answer-for-the-calculation-of-mean-in-splunk/m-p/104086#M183136</guid>
      <dc:creator>sowings</dc:creator>
      <dc:date>2012-10-26T15:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: Getting a wrong answer for the calculation of mean in splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-a-wrong-answer-for-the-calculation-of-mean-in-splunk/m-p/104087#M183137</link>
      <description>&lt;P&gt;Ahaa.. Got it. I understand it now on why it messed it up. Thanks for the clarification.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2012 15:58:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-a-wrong-answer-for-the-calculation-of-mean-in-splunk/m-p/104087#M183137</guid>
      <dc:creator>theouhuios</dc:creator>
      <dc:date>2012-10-26T15:58:27Z</dc:date>
    </item>
  </channel>
</rss>

