<?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: summing up rows by two column in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/summing-up-rows-by-two-column/m-p/523077#M147540</link>
    <description>&lt;P&gt;You are correct. it should be 70. Sorry, typo on my end.&lt;/P&gt;</description>
    <pubDate>Mon, 05 Oct 2020 22:05:43 GMT</pubDate>
    <dc:creator>ISP8055</dc:creator>
    <dc:date>2020-10-05T22:05:43Z</dc:date>
    <item>
      <title>summing up rows by two column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/summing-up-rows-by-two-column/m-p/522757#M147426</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I have a table with 5 fields.&amp;nbsp;&lt;BR /&gt;E column is numeric value, C is sub category of A&lt;BR /&gt;&lt;BR /&gt;I want to sum E by column C AND column A.&lt;BR /&gt;&lt;BR /&gt;A B C D E&lt;BR /&gt;a&amp;nbsp; &amp;nbsp; &amp;nbsp;x&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;30&lt;/P&gt;&lt;P&gt;a&amp;nbsp; &amp;nbsp; &amp;nbsp;y&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;20&lt;/P&gt;&lt;P&gt;a&amp;nbsp; &amp;nbsp; &amp;nbsp;x&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;40&lt;/P&gt;&lt;P&gt;b&amp;nbsp; &amp;nbsp; y&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 10&lt;/P&gt;&lt;P&gt;b&amp;nbsp; &amp;nbsp; x&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 40&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;if I do stats(sum E) by A = it will give output of sum of first three rows of E.&lt;BR /&gt;if I do stats(sum E) by c = it will give output of rows by x and by e.&amp;nbsp;&lt;BR /&gt;I want to output be like a x 50&amp;nbsp; ( 50 is 30 + 20 in this case)&lt;/P&gt;&lt;P&gt;Hope, I conveyed what I'm going for.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Oct 2020 22:48:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/summing-up-rows-by-two-column/m-p/522757#M147426</guid>
      <dc:creator>ISP8055</dc:creator>
      <dc:date>2020-10-02T22:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: summing up rows by two column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/summing-up-rows-by-two-column/m-p/522760#M147427</link>
      <description>&lt;P&gt;I think what you want is ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats sum(E) by A, C&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And that should give you your answer.&amp;nbsp; (I think you miscalculated your example.&amp;nbsp; ax should be 30+40=70 and is the first and third lines, right?).&lt;/P&gt;&lt;P&gt;The output I get is&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;A	C	sum(E)
a	x	70
a	y	20
b	x	40
b	y	10&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And the run-anywhere search you can test with yourself was:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval testData = "a,x,30 a,y,20 a,x,40 b,y,10 b,x,40"
| makemv delim=" " testData
| mvexpand testData
| makemv delim="," testData
| eval A = mvindex(testData, 0), C = mvindex(testData,1), E = mvindex(testData, 2)
| stats sum(E) by A, C&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Happy Splunking!&lt;/P&gt;&lt;P&gt;-Rich&lt;/P&gt;</description>
      <pubDate>Sat, 03 Oct 2020 00:57:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/summing-up-rows-by-two-column/m-p/522760#M147427</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2020-10-03T00:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: summing up rows by two column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/summing-up-rows-by-two-column/m-p/523077#M147540</link>
      <description>&lt;P&gt;You are correct. it should be 70. Sorry, typo on my end.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Oct 2020 22:05:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/summing-up-rows-by-two-column/m-p/523077#M147540</guid>
      <dc:creator>ISP8055</dc:creator>
      <dc:date>2020-10-05T22:05:43Z</dc:date>
    </item>
  </channel>
</rss>

