<?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 calculate the sum of selected values by excluding other values in a multivalue field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-sum-of-selected-values-by-excluding-other/m-p/252244#M75456</link>
    <description>&lt;P&gt;Hi Rich,&lt;/P&gt;

&lt;P&gt;Thanks for quick response. &lt;/P&gt;

&lt;P&gt;By excluding the pending time, do you mean to exclude the time between two consecutive events if the earliest event of the pair is a "Pending?" Like this group which is worth about 4.5 hours&lt;/P&gt;

&lt;P&gt;Yes, excluding the pending times which occurs multiple times for an incident.If the earliest event of the pair is "Pending" then calculate the time difference with next immediate status and then exclude the time in consolidate time( i.e Ticket Closed Time - Ticket Open Time ).&lt;/P&gt;

&lt;P&gt;Example:&lt;BR /&gt;
Ticket Opened - 12-01-2016 :01:0:0&lt;BR /&gt;
Ticket In Progress-12-01-2016:03:0:0&lt;BR /&gt;
Ticket Pending - 12-01-2016:08:0:0&lt;BR /&gt;
Ticket In Progress - 12-01-2016:12:0:0&lt;BR /&gt;
Ticket Assigned - 12-01-2016:14:0:0&lt;BR /&gt;
Ticket Pending-12-01-2016 16:0:0&lt;BR /&gt;
Ticket In Progress -12-01-2016 18:0:0&lt;BR /&gt;
Ticket Pending 12-01-2016 20:0:0&lt;BR /&gt;
Ticket In Progress -12-01-2016 :22:0:0&lt;BR /&gt;
Ticket Closed - 12-01-2016 24.:0:0&lt;/P&gt;

&lt;P&gt;Total Time - ( 12-01-2016 24.:0:0 ,12-01-2016 :01:0:0) -&amp;gt;23 hrs&lt;BR /&gt;
Pending time - (12-01-2016:12:0:0 ,12-01-2016:08:0:0)-&amp;gt;4hrs&lt;BR /&gt;
Pending time - (12-01-2016 18:0:0 ,12-01-2016 16:0:0)-&amp;gt;2hrs&lt;BR /&gt;
Pending time - (12-01-2016:22:0:0 ,12-01-2016 20:0:0)-&amp;gt;2hrs&lt;BR /&gt;
Total Pending time - 4+2+2 -&amp;gt;8&lt;/P&gt;

&lt;P&gt;Actual Time = Total Time - Pending Time &lt;BR /&gt;
Actual Time = 23 -8 -&amp;gt;15 hrs&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Ravi&lt;/P&gt;</description>
    <pubDate>Thu, 01 Dec 2016 13:32:22 GMT</pubDate>
    <dc:creator>ravinallaparedd</dc:creator>
    <dc:date>2016-12-01T13:32:22Z</dc:date>
    <item>
      <title>How to calculate the sum of selected values by excluding other values in a multivalue field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-sum-of-selected-values-by-excluding-other/m-p/252242#M75454</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I would like to know how to calculate sum of selected values by excluding other values in a multivalue field. &lt;/P&gt;

&lt;P&gt;Refer to the below ticket data sample. A ticket contains different status such as Created, Assigned, In Progress, Pending, Resolved, Closed, and some of the statuses are repeated and each row is associated with a timestamp when the ticket got updated with a different status.&lt;/P&gt;

&lt;P&gt;I would like to calculate the actual Ticket time by excluding pending hours in the below sample data. If the total time taken for ticket closed is 100 hrs and out 100 hrs there are 25hrs pending status then the actual time taken for ticket closed is 75hrs.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;TicketNum      Description  Group    Owner    Status        Date

INC200039404    No Access   Group A   XYZ,   Created,      Sep 9, 2016 3:42:53 AM
INC200039404    No Access   Group B                       Sep 9, 2016 4:31:07 AM
INC200039404    No Access                      In Progress   Sep 9, 2016 3:11:15 PM
INC200039404    No Access                      Resolved   Sep 9, 2016 3:12:47 PM
INC200039404    No Access                      Closed       Sep 15, 2016 6:05:16 AM
INC200039404    No Access   Group C         Assigned      Sep 9, 2016 2:48:45 AM
INC200039404    No Access                      Pending     Sep 9, 2016 2:52:21 AM
INC200039404    No Access                      Assigned   Sep 9, 2016 7:18:07 PM
INC200039404    No Access                      In Progress   Sep 9, 2016 7:19:05 PM
INC200039404    No Access                      Pending     Sep 9, 2016 8:30:21 PM
INC200039404    No Access                      In Progress   Sep 9, 2016 8:43:40 PM
INC200039404    No Access                      Pending     Sep 9, 2016 8:44:33 PM
INC200039404    No Access                      In Progress   Sep 9, 2016 9:00:45 PM
INC200039404    No Access                      Pending     Sep 9, 2016 9:01:34 PM
INC200039404    No Access                      In Progress   Sep 9, 2016 9:43:03 PM
INC200039404    No Access   Group A         Assigned      Sep 9, 2016 9:46:17 PM
INC200039404    No Access                                    Sep 9, 2016 9:48:49 PM
INC200039404    No Access                      Closed       Sep 9, 2016 10:04:45 PM
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks in Advance,&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Ravi&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2016 07:58:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-sum-of-selected-values-by-excluding-other/m-p/252242#M75454</guid>
      <dc:creator>ravinallaparedd</dc:creator>
      <dc:date>2016-12-01T07:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the sum of selected values by excluding other values in a multivalue field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-sum-of-selected-values-by-excluding-other/m-p/252243#M75455</link>
      <description>&lt;P&gt;Please clarify:  By excluding the pending time, do you mean to exclude the time between two consecutive events if the &lt;STRONG&gt;earliest&lt;/STRONG&gt; event of the pair is a "Pending?"  Like this group which is worth about 4.5 hours:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;INC200039404 No Access Pending Sep 9, 2016 2:52:21 AM
INC200039404 No Access Assigned Sep 9, 2016 7:18:07 PM
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But not where the Pending is the &lt;STRONG&gt;latest&lt;/STRONG&gt; event as in the pair below?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;INC200039404 No Access Group C Assigned Sep 9, 2016 2:48:45 AM
INC200039404 No Access Pending Sep 9, 2016 2:52:21 AM
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Granted there's probably no one else who needs this clarification, but I do.  &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2016 12:49:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-sum-of-selected-values-by-excluding-other/m-p/252243#M75455</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2016-12-01T12:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the sum of selected values by excluding other values in a multivalue field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-sum-of-selected-values-by-excluding-other/m-p/252244#M75456</link>
      <description>&lt;P&gt;Hi Rich,&lt;/P&gt;

&lt;P&gt;Thanks for quick response. &lt;/P&gt;

&lt;P&gt;By excluding the pending time, do you mean to exclude the time between two consecutive events if the earliest event of the pair is a "Pending?" Like this group which is worth about 4.5 hours&lt;/P&gt;

&lt;P&gt;Yes, excluding the pending times which occurs multiple times for an incident.If the earliest event of the pair is "Pending" then calculate the time difference with next immediate status and then exclude the time in consolidate time( i.e Ticket Closed Time - Ticket Open Time ).&lt;/P&gt;

&lt;P&gt;Example:&lt;BR /&gt;
Ticket Opened - 12-01-2016 :01:0:0&lt;BR /&gt;
Ticket In Progress-12-01-2016:03:0:0&lt;BR /&gt;
Ticket Pending - 12-01-2016:08:0:0&lt;BR /&gt;
Ticket In Progress - 12-01-2016:12:0:0&lt;BR /&gt;
Ticket Assigned - 12-01-2016:14:0:0&lt;BR /&gt;
Ticket Pending-12-01-2016 16:0:0&lt;BR /&gt;
Ticket In Progress -12-01-2016 18:0:0&lt;BR /&gt;
Ticket Pending 12-01-2016 20:0:0&lt;BR /&gt;
Ticket In Progress -12-01-2016 :22:0:0&lt;BR /&gt;
Ticket Closed - 12-01-2016 24.:0:0&lt;/P&gt;

&lt;P&gt;Total Time - ( 12-01-2016 24.:0:0 ,12-01-2016 :01:0:0) -&amp;gt;23 hrs&lt;BR /&gt;
Pending time - (12-01-2016:12:0:0 ,12-01-2016:08:0:0)-&amp;gt;4hrs&lt;BR /&gt;
Pending time - (12-01-2016 18:0:0 ,12-01-2016 16:0:0)-&amp;gt;2hrs&lt;BR /&gt;
Pending time - (12-01-2016:22:0:0 ,12-01-2016 20:0:0)-&amp;gt;2hrs&lt;BR /&gt;
Total Pending time - 4+2+2 -&amp;gt;8&lt;/P&gt;

&lt;P&gt;Actual Time = Total Time - Pending Time &lt;BR /&gt;
Actual Time = 23 -8 -&amp;gt;15 hrs&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Ravi&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2016 13:32:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-sum-of-selected-values-by-excluding-other/m-p/252244#M75456</guid>
      <dc:creator>ravinallaparedd</dc:creator>
      <dc:date>2016-12-01T13:32:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the sum of selected values by excluding other values in a multivalue field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-sum-of-selected-values-by-excluding-other/m-p/252245#M75457</link>
      <description>&lt;P&gt;Try this  TicketNum Description Group Ower Status Date&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | streamstats window=1 current=f latest(_time) as nextTime latest(Status) as nextStatus by TicketNum| eval p_dur=if(Status="Pending", nextTime-_time, null()) | stats sum(p_dur) as pending earliest(_time) as create latest(eval(if(Status="Closed", _time, null()))) as closed by TicketNum | where isnotnull(closed) | eval total_time=(closed-open)-pending | eval total_time=tostring(total_time, "duration")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/6.5.1/SearchReference/Streamstats"&gt;https://docs.splunk.com/Documentation/Splunk/6.5.1/SearchReference/Streamstats&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2016 14:48:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-sum-of-selected-values-by-excluding-other/m-p/252245#M75457</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-12-01T14:48:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the sum of selected values by excluding other values in a multivalue field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-sum-of-selected-values-by-excluding-other/m-p/252246#M75458</link>
      <description>&lt;P&gt;Hello Rich, Sundareshr,&lt;/P&gt;

&lt;P&gt;I got the solution from inputs which you provided.&lt;/P&gt;

&lt;P&gt;Thank you very much.&lt;BR /&gt;
Regards,&lt;BR /&gt;
Ravi&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2016 11:32:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-sum-of-selected-values-by-excluding-other/m-p/252246#M75458</guid>
      <dc:creator>ravinallaparedd</dc:creator>
      <dc:date>2016-12-02T11:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the sum of selected values by excluding other values in a multivalue field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-sum-of-selected-values-by-excluding-other/m-p/252247#M75459</link>
      <description>&lt;P&gt;Hi @ravinallapareddy&lt;/P&gt;

&lt;P&gt;Glad you found a solution through @sundareshr , but please don't forget to resolve the post by clicking "Accept" directly below his answer. Also, be sure to upvote his answer for helping you out.&lt;/P&gt;</description>
      <pubDate>Sun, 11 Dec 2016 23:21:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-sum-of-selected-values-by-excluding-other/m-p/252247#M75459</guid>
      <dc:creator>ppablo</dc:creator>
      <dc:date>2016-12-11T23:21:45Z</dc:date>
    </item>
  </channel>
</rss>

