<?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 sum specific field value in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/sum-specific-field-value/m-p/422465#M191053</link>
    <description>&lt;P&gt;I have below events-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;value=1
value=3
value=5
value=0
value=4
value=5
value=6
value=0
value=1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here I want to pick last value before value=0 and at end value if there is no zero value at end like in above case I want value=5 and  value=6 and  value=1&lt;BR /&gt;
and add these value to get result as &lt;CODE&gt;value=12&lt;/CODE&gt;&lt;BR /&gt;
Kindly guide me to achieve this.&lt;BR /&gt;
In script it can be done by storing variable and at end adding all. How this can be done in splunk.&lt;BR /&gt;
Thanks.&lt;/P&gt;</description>
    <pubDate>Fri, 02 Aug 2019 11:17:38 GMT</pubDate>
    <dc:creator>ips_mandar</dc:creator>
    <dc:date>2019-08-02T11:17:38Z</dc:date>
    <item>
      <title>sum specific field value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sum-specific-field-value/m-p/422465#M191053</link>
      <description>&lt;P&gt;I have below events-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;value=1
value=3
value=5
value=0
value=4
value=5
value=6
value=0
value=1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here I want to pick last value before value=0 and at end value if there is no zero value at end like in above case I want value=5 and  value=6 and  value=1&lt;BR /&gt;
and add these value to get result as &lt;CODE&gt;value=12&lt;/CODE&gt;&lt;BR /&gt;
Kindly guide me to achieve this.&lt;BR /&gt;
In script it can be done by storing variable and at end adding all. How this can be done in splunk.&lt;BR /&gt;
Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2019 11:17:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sum-specific-field-value/m-p/422465#M191053</guid>
      <dc:creator>ips_mandar</dc:creator>
      <dc:date>2019-08-02T11:17:38Z</dc:date>
    </item>
    <item>
      <title>Re: sum specific field value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sum-specific-field-value/m-p/422466#M191054</link>
      <description>&lt;P&gt;You can try this,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval value="1,3,5,0,4,5,6,0,1" 
| makemv delim="," value 
| mvexpand value 
| fields - _time 
| streamstats current=f window=1 last(value) as break 
| append 
   [| makeresults 
   | eval value="1,3,5,0,4,5,6,0,1" 
   | makemv delim="," value 
   | mvexpand value 
   | fields - _time 
   | stats last(value) as final] 
| fillnull value=0 
| search value=0 
| eval sum=break+final 
| stats sum(sum) as sum 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In your case, it will be &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;`your query`
|  streamstats current=f window=1 last(value) as break 
| append 
   [| `your query`
   | stats last(value) as final] 
| fillnull value=0 
| search value=0 
| eval sum=break+final 
| stats sum(sum) as sum
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Aug 2019 12:30:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sum-specific-field-value/m-p/422466#M191054</guid>
      <dc:creator>bangalorep</dc:creator>
      <dc:date>2019-08-02T12:30:30Z</dc:date>
    </item>
  </channel>
</rss>

