<?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 multiple fields count values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-multiple-fields-count-values/m-p/483172#M135306</link>
    <description>&lt;P&gt;Try below&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| stats count as Total , count(eval(field="Survey_Question1") ) as Count1 , count(eval(field="Survey_Question2") ) as Count2 ,count(eval(field="Survey_Question3") ) as Count3 , count(eval(field="Survey_Question4") ) as Count4 , count(eval(field="Survey_Question5") ) as Count5 ,count(eval(field="Survey_Question6") ) as Count6   &lt;BR /&gt;
| eval TotalCount=round(((Count1+Count2+Count3+Count4+Count5+Count6 )/6),2)&lt;/CODE&gt; &lt;/P&gt;</description>
    <pubDate>Tue, 17 Sep 2019 17:21:49 GMT</pubDate>
    <dc:creator>Anantha123</dc:creator>
    <dc:date>2019-09-17T17:21:49Z</dc:date>
    <item>
      <title>How to add multiple fields count values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-multiple-fields-count-values/m-p/483171#M135305</link>
      <description>&lt;P&gt;Hello, &lt;/P&gt;

&lt;P&gt;I have 6 fields that I would like to count and then add all the count values together.&lt;/P&gt;

&lt;P&gt;For example I have Survey_Question1, I stats count by that field which produces. &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;(NULL)    5630&lt;BR /&gt;
1              2&lt;BR /&gt;
3              4&lt;BR /&gt;
4              24&lt;BR /&gt;
5              558&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;The 1, 2, 3, 4, 5 are the rating given on the survey. &lt;/P&gt;

&lt;P&gt;I have Survey_Question1-Survey_Questions6 I would like to get all their count values and then add them together so then I can divide by 6 and get an average, that I can then visualize onto a dashboard.&lt;/P&gt;

&lt;P&gt;Hope this makes sense! &lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:12:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-multiple-fields-count-values/m-p/483171#M135305</guid>
      <dc:creator>cooperjaram</dc:creator>
      <dc:date>2020-09-30T02:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to add multiple fields count values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-multiple-fields-count-values/m-p/483172#M135306</link>
      <description>&lt;P&gt;Try below&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| stats count as Total , count(eval(field="Survey_Question1") ) as Count1 , count(eval(field="Survey_Question2") ) as Count2 ,count(eval(field="Survey_Question3") ) as Count3 , count(eval(field="Survey_Question4") ) as Count4 , count(eval(field="Survey_Question5") ) as Count5 ,count(eval(field="Survey_Question6") ) as Count6   &lt;BR /&gt;
| eval TotalCount=round(((Count1+Count2+Count3+Count4+Count5+Count6 )/6),2)&lt;/CODE&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2019 17:21:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-multiple-fields-count-values/m-p/483172#M135306</guid>
      <dc:creator>Anantha123</dc:creator>
      <dc:date>2019-09-17T17:21:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to add multiple fields count values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-multiple-fields-count-values/m-p/483173#M135307</link>
      <description>&lt;P&gt;When I attempt this I get the below error.&lt;/P&gt;

&lt;P&gt;Error in 'stats' command: The dynamically evaluated field specifier 'eval(field="Survey_Question1") ' is invalid. The field specifier must be non-empty, start with '{', and end with '}'.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2019 18:27:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-multiple-fields-count-values/m-p/483173#M135307</guid>
      <dc:creator>cooperjaram</dc:creator>
      <dc:date>2019-09-17T18:27:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to add multiple fields count values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-multiple-fields-count-values/m-p/483174#M135308</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count as Total ,
        sum(eval(field="Survey_Question1") ) as Count1,
        sum(eval(field="Survey_Question2") ) as Count2,
        sum(eval(field="Survey_Question3") ) as Count3, 
        sum(eval(field="Survey_Question4") ) as Count4, 
        sum(eval(field="Survey_Question5") ) as Count5,
        sum(eval(field="Survey_Question6") ) as Count6
| eval TotalCount=round(((Count1+Count2+Count3+Count4+Count5+Count6 )/6),2)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Sep 2019 19:12:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-multiple-fields-count-values/m-p/483174#M135308</guid>
      <dc:creator>jacobpevans</dc:creator>
      <dc:date>2019-09-17T19:12:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to add multiple fields count values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-multiple-fields-count-values/m-p/483175#M135309</link>
      <description>&lt;P&gt;I get the same error when I attempt this. &lt;/P&gt;

&lt;P&gt;Error in 'stats' command: The dynamically evaluated field specifier 'eval(field="Survey_Question1") ' is invalid. The field specifier must be non-empty, start with '{', and end with '}'.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2019 14:45:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-multiple-fields-count-values/m-p/483175#M135309</guid>
      <dc:creator>cooperjaram</dc:creator>
      <dc:date>2019-09-18T14:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to add multiple fields count values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-multiple-fields-count-values/m-p/483176#M135310</link>
      <description>&lt;P&gt;Please try below method. &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;basesearch field="Survey_Question1" &lt;BR /&gt;
| stats count as Count1 &lt;BR /&gt;
| appendcols &lt;BR /&gt;
    [ search basesearch field="Survey_Question2" &lt;BR /&gt;
    | stats count as Count2 ] &lt;BR /&gt;
| appendcols &lt;BR /&gt;
    [ search basesearch field="Survey_Question3" &lt;BR /&gt;
    | stats count as Count3 ] &lt;BR /&gt;
| appendcols &lt;BR /&gt;
    [ search basesearch field="Survey_Question4" &lt;BR /&gt;
    | stats count as Count4 ] &lt;BR /&gt;
| appendcols &lt;BR /&gt;
    [ search basesearch field="Survey_Question5" &lt;BR /&gt;
    | stats count as Count5 ] &lt;BR /&gt;
| appendcols &lt;BR /&gt;
    [ search basesearch field="Survey_Question6" &lt;BR /&gt;
    | stats count as Count6 ] &lt;BR /&gt;
| table Count1,Count2,Count3,Count4,Count5,Count6 &lt;BR /&gt;
| eval TotalCount=round(((Count1+Count2+Count3+Count4+Count5+Count6 )/2),2) &lt;BR /&gt;
| table TotalCount&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2019 14:47:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-multiple-fields-count-values/m-p/483176#M135310</guid>
      <dc:creator>Anantha123</dc:creator>
      <dc:date>2019-09-18T14:47:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to add multiple fields count values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-multiple-fields-count-values/m-p/483177#M135311</link>
      <description>&lt;P&gt;This worked, thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2019 15:27:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-multiple-fields-count-values/m-p/483177#M135311</guid>
      <dc:creator>cooperjaram</dc:creator>
      <dc:date>2019-09-18T15:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to add multiple fields count values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-multiple-fields-count-values/m-p/483178#M135312</link>
      <description>&lt;P&gt;Hm. I assume you're replaying &lt;CODE&gt;field&lt;/CODE&gt; with your actual field name, correct? Apologies for the dumb question, just want to make sure we aren't missing anything easy.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2019 05:16:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-multiple-fields-count-values/m-p/483178#M135312</guid>
      <dc:creator>jacobpevans</dc:creator>
      <dc:date>2019-09-24T05:16:05Z</dc:date>
    </item>
  </channel>
</rss>

