<?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: How to add results from stats value? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-results-from-stats-value/m-p/307482#M92247</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;Try this please:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval PFM =if(departement="Production for Medicine " OR departement="Production for Medicine-PFM",count,0)
| eventstats sum(PFM) as sum
|appendpipe[departement="Production for Medicine + Production for Medicine-PFM", count=sum]
| fields -sum
| dedup departement 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 29 Mar 2018 15:15:03 GMT</pubDate>
    <dc:creator>TISKAR</dc:creator>
    <dc:date>2018-03-29T15:15:03Z</dc:date>
    <item>
      <title>How to add results from stats value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-results-from-stats-value/m-p/307480#M92245</link>
      <description>&lt;P&gt;Hi &lt;/P&gt;

&lt;P&gt;I have a field called department, on that field i have multiple values like &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;department=Production for Medicine 
department=Research and Development
department=Purchasing
department=Marketing
department=Human Resource Management
department=Accounting and Finance 
department=Production for Medicine-PFM
department=Research and Development-RD
 So after running stats count by department am getting below results like

department                                  count

Production for Medicine                   5
Research and Development             10
Purchasing                                          12
Marketing                                             6
Human Resource Management        3
Accounting and Finance                      4
Production for Medicine-PFM             6
Research and Development-RD         13
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I need is to add count value of following: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Production for Medicine + Production for Medicine-PFM =11
Research and Development + Research and Development-RD  =23
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Kindly let me know if there is any solution to get above result.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 13:05:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-results-from-stats-value/m-p/307480#M92245</guid>
      <dc:creator>n4niyaz</dc:creator>
      <dc:date>2018-03-29T13:05:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to add results from stats value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-results-from-stats-value/m-p/307481#M92246</link>
      <description>&lt;P&gt;You could drop everything after and including the dash from the department name using a regex&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=department mode=sed "s/-.*$//"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Mar 2018 14:59:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-results-from-stats-value/m-p/307481#M92246</guid>
      <dc:creator>kmaron</dc:creator>
      <dc:date>2018-03-29T14:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to add results from stats value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-results-from-stats-value/m-p/307482#M92247</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;Try this please:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval PFM =if(departement="Production for Medicine " OR departement="Production for Medicine-PFM",count,0)
| eventstats sum(PFM) as sum
|appendpipe[departement="Production for Medicine + Production for Medicine-PFM", count=sum]
| fields -sum
| dedup departement 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Mar 2018 15:15:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-results-from-stats-value/m-p/307482#M92247</guid>
      <dc:creator>TISKAR</dc:creator>
      <dc:date>2018-03-29T15:15:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to add results from stats value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-results-from-stats-value/m-p/307483#M92248</link>
      <description>&lt;P&gt;Thanks for the reply but  i need is sum of total count of Production for Medicine + Production for Medicine-PFM =11 in a separate field either  PFM=11 means count of Production for Medicine(6) + Production for Medicine-PFM(5)=PFM ie PFM =6+5 ie PFM=11 and here &lt;BR /&gt;
Research and Development (10)+ Research and Development-RD(13) =23 RD=23 ie RD=10+13 ie RD=23&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 16:38:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-results-from-stats-value/m-p/307483#M92248</guid>
      <dc:creator>n4niyaz</dc:creator>
      <dc:date>2018-03-29T16:38:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to add results from stats value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-results-from-stats-value/m-p/307484#M92249</link>
      <description>&lt;P&gt;try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=department "(?&amp;lt;base_department&amp;gt;.*)-\S"
| stats count by department, base_department
| appendpipe [stats sum(count) as count by base_department]
| sort base_department
| fields - base_department
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Mar 2018 19:43:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-results-from-stats-value/m-p/307484#M92249</guid>
      <dc:creator>kmaron</dc:creator>
      <dc:date>2018-03-29T19:43:37Z</dc:date>
    </item>
  </channel>
</rss>

