<?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: Set limit to Accum value in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Set-limit-to-Accum-value/m-p/183125#M186946</link>
    <description>&lt;P&gt;ok..in the case a simple eval statement would do the trick for u.&lt;/P&gt;

&lt;P&gt;[your search] | accum n as sum | eval sum = if(sum&amp;lt;0,0,sum) | table n,sum  &lt;/P&gt;

&lt;P&gt;this will not let sum below 0 &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Mar 2014 11:46:18 GMT</pubDate>
    <dc:creator>rakesh_498115</dc:creator>
    <dc:date>2014-03-12T11:46:18Z</dc:date>
    <item>
      <title>Set limit to Accum value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Set-limit-to-Accum-value/m-p/183122#M186943</link>
      <description>&lt;P&gt;I have a list of +1 and -1 that I would like to sum them up as events happen, but I do not want the sum to go below 0. If the current sum is 0 and the new variable is -1, it will simply remain at 0. Any idea how to do this?&lt;BR /&gt;
Eg.&lt;BR /&gt;
n          sum&lt;BR /&gt;
1          1&lt;BR /&gt;
-1         0&lt;BR /&gt;
-1         0&lt;BR /&gt;
-1         0&lt;BR /&gt;
1          1&lt;BR /&gt;
1          2&lt;BR /&gt;
-1         1&lt;BR /&gt;
Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 12 Mar 2014 04:36:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Set-limit-to-Accum-value/m-p/183122#M186943</guid>
      <dc:creator>weihtee</dc:creator>
      <dc:date>2014-03-12T04:36:13Z</dc:date>
    </item>
    <item>
      <title>Re: Set limit to Accum value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Set-limit-to-Accum-value/m-p/183123#M186944</link>
      <description>&lt;P&gt;Hi Weihtee,&lt;/P&gt;

&lt;P&gt;You can use the where condition to emlinate counting those -1's  like below,&lt;/P&gt;

&lt;P&gt;[your search] | where n &amp;gt; 0 | accum n as sum | table n,sum&lt;/P&gt;

&lt;P&gt;Hope this Helps !! &lt;/P&gt;</description>
      <pubDate>Wed, 12 Mar 2014 07:18:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Set-limit-to-Accum-value/m-p/183123#M186944</guid>
      <dc:creator>rakesh_498115</dc:creator>
      <dc:date>2014-03-12T07:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: Set limit to Accum value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Set-limit-to-Accum-value/m-p/183124#M186945</link>
      <description>&lt;P&gt;Hi thanks, but I need the -1's since if the sum is any number above 0, it is still useful( eg 4, it would get the sum to 4-1=3)&lt;BR /&gt;
I just need the sum to not go below 0 &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Mar 2014 07:34:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Set-limit-to-Accum-value/m-p/183124#M186945</guid>
      <dc:creator>weihtee</dc:creator>
      <dc:date>2014-03-12T07:34:29Z</dc:date>
    </item>
    <item>
      <title>Re: Set limit to Accum value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Set-limit-to-Accum-value/m-p/183125#M186946</link>
      <description>&lt;P&gt;ok..in the case a simple eval statement would do the trick for u.&lt;/P&gt;

&lt;P&gt;[your search] | accum n as sum | eval sum = if(sum&amp;lt;0,0,sum) | table n,sum  &lt;/P&gt;

&lt;P&gt;this will not let sum below 0 &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Mar 2014 11:46:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Set-limit-to-Accum-value/m-p/183125#M186946</guid>
      <dc:creator>rakesh_498115</dc:creator>
      <dc:date>2014-03-12T11:46:18Z</dc:date>
    </item>
  </channel>
</rss>

