<?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: Sum up values into a row with the data grouped by fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Sum-up-values-into-a-row-with-the-data-grouped-by-fields/m-p/361199#M106701</link>
    <description>&lt;P&gt;Can you try somethins:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval abc="G1 1,G1 5,G1 1,G1 1,G3 3,G3 3,G3 3"  | makemv delim="," abc | mvexpand abc | rex field=abc "(?P&amp;lt;Group&amp;gt;[^\s]+)\s(?P&amp;lt;Value&amp;gt;.+)" | stats sum(Value) list(Value) AS abc1 by Group  | mvexpand abc1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval abc="G1 1 G1 5 G1 1 G1 1 G3 3 G3 3 G3 3"  | rex field=abc max_match=0 "(?P&amp;lt;Group&amp;gt;[^\s]+)\s(?P&amp;lt;Value&amp;gt;[^\s]+)" | eval ab=mvzip(Group,Value) | mvexpand ab | rex field=ab max_match=0 "(?P&amp;lt;Group&amp;gt;[^,]+),(?P&amp;lt;Value&amp;gt;.+)" | stats sum(Value) AS Sum list(Value) AS Value by Group | mvexpand Value
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 25 Apr 2018 04:03:48 GMT</pubDate>
    <dc:creator>p_gurav</dc:creator>
    <dc:date>2018-04-25T04:03:48Z</dc:date>
    <item>
      <title>Sum up values into a row with the data grouped by fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sum-up-values-into-a-row-with-the-data-grouped-by-fields/m-p/361198#M106700</link>
      <description>&lt;P&gt;I have the below sample data&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;Groups    Values&lt;BR /&gt;
G1  1&lt;BR /&gt;
G1  2&lt;BR /&gt;
G1  1&lt;BR /&gt;
G1  2&lt;BR /&gt;
G3  3&lt;BR /&gt;
G3  3&lt;BR /&gt;
G3  3&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I am looking to sum up the values field grouped by the Groups and have it displayed as below . &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Groups  Values  Sum
G1  1   8
G1  5   8
G1  1   8
G1  1   8
G3  3   9
G3  3   9
G3  3   9
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;the reason is that i need to eventually develop a scorecard model from each of the Groups and other variables in each row. All help is appreciated. &lt;/P&gt;

&lt;P&gt;thank You to all the splunk gurus here. &lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 03:20:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sum-up-values-into-a-row-with-the-data-grouped-by-fields/m-p/361198#M106700</guid>
      <dc:creator>madakkas</dc:creator>
      <dc:date>2018-04-25T03:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: Sum up values into a row with the data grouped by fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sum-up-values-into-a-row-with-the-data-grouped-by-fields/m-p/361199#M106701</link>
      <description>&lt;P&gt;Can you try somethins:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval abc="G1 1,G1 5,G1 1,G1 1,G3 3,G3 3,G3 3"  | makemv delim="," abc | mvexpand abc | rex field=abc "(?P&amp;lt;Group&amp;gt;[^\s]+)\s(?P&amp;lt;Value&amp;gt;.+)" | stats sum(Value) list(Value) AS abc1 by Group  | mvexpand abc1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval abc="G1 1 G1 5 G1 1 G1 1 G3 3 G3 3 G3 3"  | rex field=abc max_match=0 "(?P&amp;lt;Group&amp;gt;[^\s]+)\s(?P&amp;lt;Value&amp;gt;[^\s]+)" | eval ab=mvzip(Group,Value) | mvexpand ab | rex field=ab max_match=0 "(?P&amp;lt;Group&amp;gt;[^,]+),(?P&amp;lt;Value&amp;gt;.+)" | stats sum(Value) AS Sum list(Value) AS Value by Group | mvexpand Value
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Apr 2018 04:03:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sum-up-values-into-a-row-with-the-data-grouped-by-fields/m-p/361199#M106701</guid>
      <dc:creator>p_gurav</dc:creator>
      <dc:date>2018-04-25T04:03:48Z</dc:date>
    </item>
    <item>
      <title>Re: Sum up values into a row with the data grouped by fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sum-up-values-into-a-row-with-the-data-grouped-by-fields/m-p/361200#M106702</link>
      <description>&lt;P&gt;What do your raw events (fields) look like?&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 04:24:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sum-up-values-into-a-row-with-the-data-grouped-by-fields/m-p/361200#M106702</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-04-25T04:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: Sum up values into a row with the data grouped by fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sum-up-values-into-a-row-with-the-data-grouped-by-fields/m-p/361201#M106703</link>
      <description>&lt;P&gt;Raw Events are in a csv file&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 05:32:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sum-up-values-into-a-row-with-the-data-grouped-by-fields/m-p/361201#M106703</guid>
      <dc:creator>madakkas</dc:creator>
      <dc:date>2018-04-25T05:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: Sum up values into a row with the data grouped by fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sum-up-values-into-a-row-with-the-data-grouped-by-fields/m-p/361202#M106704</link>
      <description>&lt;P&gt;@madakkas, Can youu try this please:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;yourBaseSearch&amp;gt;| eventstats sum(Value) by Group
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For Example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval abc="G1 1 G1 5 G1 1 G1 1 G3 3 G3 3 G3 3"  | rex field=abc max_match=0 "(?P&amp;lt;Group&amp;gt;[^\s]+)\s(?P&amp;lt;Value&amp;gt;[^\s]+)" | eval ab=mvzip(Group,Value) | mvexpand ab | rex field=ab max_match=0 "(?P&amp;lt;Group&amp;gt;[^,]+),(?P&amp;lt;Value&amp;gt;.+)" | eventstats sum(Value) as sum by Group 
| fields Group Value sum
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Apr 2018 06:17:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sum-up-values-into-a-row-with-the-data-grouped-by-fields/m-p/361202#M106704</guid>
      <dc:creator>TISKAR</dc:creator>
      <dc:date>2018-04-25T06:17:45Z</dc:date>
    </item>
  </channel>
</rss>

