<?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: Creating multiple SUMs within a field based on the value of another field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-creating-multiple-SUMs-within-a-field-based-on-the-value-of/m-p/587941#M204760</link>
    <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/229101"&gt;@tshah-splunk&lt;/a&gt;&amp;nbsp;, but I am not &lt;U&gt;only&lt;/U&gt; trying to sum(Hours) by stage,resource.&lt;/P&gt;&lt;P&gt;I am creating a table which has multiple fields in it and within that table, I am trying to sum(hours) by stage,resource. I simplified my search in my original question but the table includes multiple fields from each of the lookups I reference in the search. In other words, I am not looking to just add the hours, I want to represent the sum of those hours within a new table.&lt;/P&gt;</description>
    <pubDate>Tue, 08 Mar 2022 04:30:14 GMT</pubDate>
    <dc:creator>raysonjoberts</dc:creator>
    <dc:date>2022-03-08T04:30:14Z</dc:date>
    <item>
      <title>Help creating multiple SUMs within a field based on the value of another field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-creating-multiple-SUMs-within-a-field-based-on-the-value-of/m-p/587925#M204753</link>
      <description>&lt;P&gt;I am using 2 lookup tables to correlate and combine data to create a new .csv. In this process, I have a field that has numerical values in it that i want to sum based on the values of another field.&amp;nbsp; The raw data looks something like this:&lt;/P&gt;
&lt;P&gt;stage,resource,hours&lt;BR /&gt;x,rick,1&lt;BR /&gt;x,rick,10&lt;BR /&gt;x,dave,1&lt;BR /&gt;y,rick,5&lt;BR /&gt;y,dave,3&lt;BR /&gt;y,dave,8&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want the output to look like:&lt;BR /&gt;x,rick,11&lt;BR /&gt;x,dave,1&lt;BR /&gt;y,rick,5&lt;BR /&gt;y,dave,11&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is the search I have, it almost works but it does not sum the totals for rick and dave individually, it sums them all, so the output looks like:&lt;/P&gt;
&lt;P&gt;x,rick,12&lt;BR /&gt;x,dave,12&lt;BR /&gt;y,rick,16&lt;BR /&gt;y,dave,16&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;|inputlookup mod_master&lt;BR /&gt;|lookup lookuptable1 Engagement OUTPUTNEW ResourceLastName,RegularHours&lt;BR /&gt;| eval Resource=mvdedup(ResourceLastName)&lt;BR /&gt;| mvexpand Resource&lt;BR /&gt;| eval Hours=sum(RegularHours)&lt;BR /&gt;| fillnull value=0 Hours&lt;BR /&gt;| table Stage,Resource,Hours&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can i change the logic in this search so I get the correct individual sums for Rick and Dave and not the combined total for each?&lt;BR /&gt;&lt;BR /&gt;Thank you in advance!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2022 05:07:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-creating-multiple-SUMs-within-a-field-based-on-the-value-of/m-p/587925#M204753</guid>
      <dc:creator>raysonjoberts</dc:creator>
      <dc:date>2022-03-08T05:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: Creating multiple SUMs within a field based on the value of another field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-creating-multiple-SUMs-within-a-field-based-on-the-value-of/m-p/587937#M204757</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/236374"&gt;@raysonjoberts&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Can you try replacing the eval function with the below line in the query please?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats sum(hours) as hours by stage resource&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;This will do a total of hours and group it w.r.t resource and the stage.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2022 04:15:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-creating-multiple-SUMs-within-a-field-based-on-the-value-of/m-p/587937#M204757</guid>
      <dc:creator>tshah-splunk</dc:creator>
      <dc:date>2022-03-08T04:15:42Z</dc:date>
    </item>
    <item>
      <title>Re: Creating multiple SUMs within a field based on the value of another field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-creating-multiple-SUMs-within-a-field-based-on-the-value-of/m-p/587941#M204760</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/229101"&gt;@tshah-splunk&lt;/a&gt;&amp;nbsp;, but I am not &lt;U&gt;only&lt;/U&gt; trying to sum(Hours) by stage,resource.&lt;/P&gt;&lt;P&gt;I am creating a table which has multiple fields in it and within that table, I am trying to sum(hours) by stage,resource. I simplified my search in my original question but the table includes multiple fields from each of the lookups I reference in the search. In other words, I am not looking to just add the hours, I want to represent the sum of those hours within a new table.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2022 04:30:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-creating-multiple-SUMs-within-a-field-based-on-the-value-of/m-p/587941#M204760</guid>
      <dc:creator>raysonjoberts</dc:creator>
      <dc:date>2022-03-08T04:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: Creating multiple SUMs within a field based on the value of another field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-creating-multiple-SUMs-within-a-field-based-on-the-value-of/m-p/587947#M204761</link>
      <description>&lt;P&gt;Can you share your data - the stats command given by&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/229101"&gt;@tshah-splunk&lt;/a&gt;&amp;nbsp;would work on what you describe as your raw data, so your data is different - can you show what the data looks like after this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|inputlookup mod_master
|lookup lookuptable1 Engagement OUTPUTNEW ResourceLastName,RegularHours&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 08 Mar 2022 06:43:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-creating-multiple-SUMs-within-a-field-based-on-the-value-of/m-p/587947#M204761</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2022-03-08T06:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: Creating multiple SUMs within a field based on the value of another field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-creating-multiple-SUMs-within-a-field-based-on-the-value-of/m-p/587976#M204775</link>
      <description>&lt;P&gt;Either you're trying to do something very confusing &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt; or you can just use eventstats instead of stats to get your summarized values along the original data so you can process it further.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2022 09:03:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-creating-multiple-SUMs-within-a-field-based-on-the-value-of/m-p/587976#M204775</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-03-08T09:03:40Z</dc:date>
    </item>
  </channel>
</rss>

