<?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: Trimmed Average Calculation in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Trimmed-Average-Calculation/m-p/437441#M171560</link>
    <description>&lt;P&gt;Hi @zacksoft  - Yes the list is limited to 100 values - &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.6/SearchReference/Multivaluefunctions"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.6/SearchReference/Multivaluefunctions&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I honestly, did not think from the examples that you had provided that in any specific case your list of values will exceed 100 .&lt;BR /&gt;
What is/could be the maximum number of values in your case?&lt;/P&gt;</description>
    <pubDate>Fri, 03 May 2019 16:09:42 GMT</pubDate>
    <dc:creator>Sukisen1981</dc:creator>
    <dc:date>2019-05-03T16:09:42Z</dc:date>
    <item>
      <title>Trimmed Average Calculation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trimmed-Average-Calculation/m-p/437436#M171555</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;host = Mayhem
sourcetype="phutans:servo" host=R00878
| eval headers=split(_raw," ")
| eval plant_length=mvindex(headers,10) | sort 0 plant_length
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(I am trying to calculate mean plant_lenght here but in a different way)&lt;/P&gt;

&lt;P&gt;Let me put it as example :&lt;BR /&gt;
say we get 10 values of plant_length. 1, 2, 2, 3, 4, 4, 4, 5, 20&lt;BR /&gt;
Ideally to get mean, we would do (1+2+2+3+4+4+4++5+20)/10&lt;BR /&gt;
But I don't want it this way. What I am looking for is to drop 10% of data in each tail and divide by number of values left.&lt;/P&gt;

&lt;P&gt;Like this : (2+2+3+4+4+4++5)/8&lt;BR /&gt;
In the numerator here the bottom 10% data (1) and top 10% of data(20) is dropped , so we have 8 vales left, hence the denominator is 8. &lt;/P&gt;

&lt;P&gt;(In the above example as we have 10 values so 10% of 10 becomes 1. Therefore 1 value is dropped from top end and 1 value from bottom end.) And after dropping 2 values the denominator has to be 8 , not 10)&lt;/P&gt;

&lt;P&gt;I could use some help in implementing the above scenario.&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2019 14:48:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trimmed-Average-Calculation/m-p/437436#M171555</guid>
      <dc:creator>zacksoft</dc:creator>
      <dc:date>2019-05-02T14:48:01Z</dc:date>
    </item>
    <item>
      <title>Re: Trimmed Average Calculation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trimmed-Average-Calculation/m-p/437437#M171556</link>
      <description>&lt;P&gt;Try this - &lt;CODE&gt;index="_audit" &lt;BR /&gt;
|  stats values(available_count)&lt;BR /&gt;
| rename values(available_count) as x&lt;BR /&gt;
| eval perc=0.1*mvcount(x)&lt;BR /&gt;
| mvexpand x&lt;BR /&gt;
| eventstats count(x) as maxcount&lt;BR /&gt;
| streamstats count as row&lt;BR /&gt;
| where row&amp;gt;perc&lt;BR /&gt;
| eval z=maxcount-row&lt;BR /&gt;
| where z&amp;gt;perc|reverse&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I have bulit out this on action_count on the _audit index, so the code works as is for you. Now I have renamed action_count as x and removed the top and bottom 10% values, the left over values of x is what you need to use to form your average.&lt;BR /&gt;
WARNING - Run this for last 7 days to have a large data set AND the values keep updating real time so look at maxcount and perc. macount is your total at any point in time and perc is what you need to trim from the bottom and top at any point of time..hope it helps &lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:24:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trimmed-Average-Calculation/m-p/437437#M171556</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2020-09-30T00:24:56Z</dc:date>
    </item>
    <item>
      <title>Re: Trimmed Average Calculation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trimmed-Average-Calculation/m-p/437438#M171557</link>
      <description>&lt;P&gt;stats value(available_count) ...gives me the unique entries only.&lt;BR /&gt;
if I have  six values such as 2,2,3,3,4,4. It only shows 2,3,4&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 11:44:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trimmed-Average-Calculation/m-p/437438#M171557</guid>
      <dc:creator>zacksoft</dc:creator>
      <dc:date>2019-05-03T11:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: Trimmed Average Calculation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trimmed-Average-Calculation/m-p/437439#M171558</link>
      <description>&lt;P&gt;hi you need to replace vlaues with list if you want non-unique values as well&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="_audit" | stats list(available_count) | rename list(available_count) as x | eval perc=0.1*mvcount(x) | mvexpand x | eventstats count(x) as maxcount | streamstats count as row | where row&amp;gt;perc | eval z=maxcount-row | where z&amp;gt;perc|reverse
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 May 2019 12:41:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trimmed-Average-Calculation/m-p/437439#M171558</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2019-05-03T12:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: Trimmed Average Calculation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trimmed-Average-Calculation/m-p/437440#M171559</link>
      <description>&lt;P&gt;The 'list' only returns 100 values. Is there anyway to override that  to see all the values?&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 14:52:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trimmed-Average-Calculation/m-p/437440#M171559</guid>
      <dc:creator>zacksoft</dc:creator>
      <dc:date>2019-05-03T14:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: Trimmed Average Calculation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trimmed-Average-Calculation/m-p/437441#M171560</link>
      <description>&lt;P&gt;Hi @zacksoft  - Yes the list is limited to 100 values - &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.6/SearchReference/Multivaluefunctions"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.6/SearchReference/Multivaluefunctions&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I honestly, did not think from the examples that you had provided that in any specific case your list of values will exceed 100 .&lt;BR /&gt;
What is/could be the maximum number of values in your case?&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 16:09:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trimmed-Average-Calculation/m-p/437441#M171560</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2019-05-03T16:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: Trimmed Average Calculation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trimmed-Average-Calculation/m-p/437442#M171561</link>
      <description>&lt;P&gt;Try this - this should account for all values , not just the list limit of 100&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="_audit" | table available_count,_time
| where isnotnull(available_count) | rename available_count as x 
|  eventstats count(x) as maxcount
| eval perc=0.1*maxcount  | streamstats count as row | where row&amp;gt;perc | eval z=maxcount-row | where z&amp;gt;perc|reverse
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 May 2019 16:23:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trimmed-Average-Calculation/m-p/437442#M171561</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2019-05-03T16:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: Trimmed Average Calculation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trimmed-Average-Calculation/m-p/437443#M171562</link>
      <description>&lt;P&gt;@Sukisen1981  Thank you for so patiently assisting with this issue. Really appreciate it. &lt;BR /&gt;
This is exactly what I wanted.&lt;BR /&gt;
If I may add one small thing...."what if instead of dropping the tail 10 % of data, I choose to replace them with the next available data.&lt;BR /&gt;
e.g. 1, 2, 2, 3, 4, 4, 4, 5, 20&lt;BR /&gt;&lt;BR /&gt;
The 10 % on each side is, 1 and 20.&lt;BR /&gt;
So the updated data set to become 2, 2, 2, 3, 4, 4, 4, 5, 5.  (I just replaced the each extreme 10 % with the nearest value). Could you please guide how to achieve this.  Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 10:47:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trimmed-Average-Calculation/m-p/437443#M171562</guid>
      <dc:creator>zacksoft</dc:creator>
      <dc:date>2019-05-06T10:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: Trimmed Average Calculation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trimmed-Average-Calculation/m-p/437444#M171563</link>
      <description>&lt;P&gt;Hi  @zacksoft - this looks  a bit tough, I suggest asking a separate question on this in the forum. Meanwhile, I will try to find a solution,many apologies but office work calls &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 15:34:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trimmed-Average-Calculation/m-p/437444#M171563</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2019-05-06T15:34:45Z</dc:date>
    </item>
    <item>
      <title>Re: Trimmed Average Calculation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trimmed-Average-Calculation/m-p/437445#M171564</link>
      <description>&lt;P&gt;Sure @Sukisen1981 . If you get time.&lt;BR /&gt;
Following is the link of the  new question.&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/744080/winsorized-average-calculation.html?minQuestionBodyLength=80"&gt;https://answers.splunk.com/answers/744080/winsorized-average-calculation.html?minQuestionBodyLength=80&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2019 14:31:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trimmed-Average-Calculation/m-p/437445#M171564</guid>
      <dc:creator>zacksoft</dc:creator>
      <dc:date>2019-05-07T14:31:05Z</dc:date>
    </item>
  </channel>
</rss>

