<?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 of maximum value of field up to point in time, over time in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/Sum-of-maximum-value-of-field-up-to-point-in-time-over-time/m-p/366753#M1086</link>
    <description>&lt;P&gt;There are many ways to do it . Try this as well&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=your_index  | stats max(Amount) as Amount by Name date_year date_month| stats sum(Amount) As total_count by date_year date_month | eval date=date_year+"-"+date_month | fields date total_count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 11 Nov 2017 12:01:22 GMT</pubDate>
    <dc:creator>mayurr98</dc:creator>
    <dc:date>2017-11-11T12:01:22Z</dc:date>
    <item>
      <title>Sum of maximum value of field up to point in time, over time</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Sum-of-maximum-value-of-field-up-to-point-in-time-over-time/m-p/366746#M1079</link>
      <description>&lt;P&gt;Edited to make my field extractions and needs clearer....&lt;/P&gt;

&lt;P&gt;This is best explained with an example of my events and what I'm looking for. I'm not entirely sure if the title accurately reflects what I'm after but it's the only way I can think to explain it right now.&lt;/P&gt;

&lt;P&gt;I have events, with appropriate field extractions, like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| _time      Name  Amount
| 2017-01-01 App-A 1000
| 2017-01-02 App-B 2000
| 2017-01-03 App-A 1500
| 2017-02-01 App-A 2000
| 2017-02-02 App-B 1500
| 2017-02-03 App-B 1500
| 2017-03-01 App-A 2000
| 2017-03-02 App-B 2500
| 2017-04-01 App-A 2500
| 2017-05-01 App-B 3000
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to chart the sum of the maximum 'amount' seen so far for each 'name', up to the time value of the x axis of the chart.&lt;/P&gt;

&lt;P&gt;The statistics should look like (without the bracketed info, this is just to make it clear how I come to the TotalAmount value):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| _time     TotalAmount
| 2017-01   3500         (1500+2000)
| 2017-02   4000         (2000+2000)
| 2017-03   4500         (2000+2500)
| 2017-04   5000         (2500+2500)
| 2017-05   5500         (2500+3000)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The main issue I am having appears to be that I can't figure out how to include a max value of 'amount' for a 'name' in the sum for a month if that name does not appear in the month bin.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2017 23:59:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Sum-of-maximum-value-of-field-up-to-point-in-time-over-time/m-p/366746#M1079</guid>
      <dc:creator>ccampbellveraco</dc:creator>
      <dc:date>2017-11-10T23:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of maximum value of field up to point in time, over time</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Sum-of-maximum-value-of-field-up-to-point-in-time-over-time/m-p/366747#M1080</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=your_index | rex field=_time “?P&amp;lt;month&amp;gt;\d{4}\-\d{2}”| stats max(Amount) as Amount by Name month | stats sum(Amount) As total_count by month
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Let me know if it works for you!!&lt;/P&gt;</description>
      <pubDate>Sat, 11 Nov 2017 03:02:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Sum-of-maximum-value-of-field-up-to-point-in-time-over-time/m-p/366747#M1080</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2017-11-11T03:02:17Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of maximum value of field up to point in time, over time</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Sum-of-maximum-value-of-field-up-to-point-in-time-over-time/m-p/366748#M1081</link>
      <description>&lt;P&gt;Hi &lt;BR /&gt;
Can you please try this one?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;YOUR_SEARCH.....
| table Date Name Amount 
| rex field=Date "(?&amp;lt;C_Month&amp;gt;.*)\-(?&amp;lt;C_Date&amp;gt;.*)" | eventstats max(C_Date) as Max_Date by Name C_Month | where C_Date=Max_Date  | stats sum(Amount) as TotalAmount by C_Month
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sat, 11 Nov 2017 07:28:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Sum-of-maximum-value-of-field-up-to-point-in-time-over-time/m-p/366748#M1081</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-11-11T07:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of maximum value of field up to point in time, over time</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Sum-of-maximum-value-of-field-up-to-point-in-time-over-time/m-p/366749#M1082</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=your_index | rex field=_time “?P&amp;lt;month&amp;gt;\d{4}\-\d{2}”| stats max(Amount) as Amount by Name month | stats sum(Amount) As total_count by month
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Let me know if it works for you!!&lt;/P&gt;</description>
      <pubDate>Sat, 11 Nov 2017 11:27:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Sum-of-maximum-value-of-field-up-to-point-in-time-over-time/m-p/366749#M1082</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2017-11-11T11:27:50Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of maximum value of field up to point in time, over time</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Sum-of-maximum-value-of-field-up-to-point-in-time-over-time/m-p/366750#M1083</link>
      <description>&lt;P&gt;That rex doesn't seem to work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Error in 'rex' command: Encountered the following error while compiling the regex '?P&amp;lt;month&amp;gt;\d{4}-\d{2}': Regex: quantifier does not follow a repeatable item
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 11 Nov 2017 11:39:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Sum-of-maximum-value-of-field-up-to-point-in-time-over-time/m-p/366750#M1083</guid>
      <dc:creator>ccampbellveraco</dc:creator>
      <dc:date>2017-11-11T11:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of maximum value of field up to point in time, over time</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Sum-of-maximum-value-of-field-up-to-point-in-time-over-time/m-p/366751#M1084</link>
      <description>&lt;P&gt;can you tell me how is your timestamp look like in an event? and where it is specified ? is it specified at the beginning or in between?&lt;/P&gt;</description>
      <pubDate>Sat, 11 Nov 2017 11:44:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Sum-of-maximum-value-of-field-up-to-point-in-time-over-time/m-p/366751#M1084</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2017-11-11T11:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of maximum value of field up to point in time, over time</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Sum-of-maximum-value-of-field-up-to-point-in-time-over-time/m-p/366752#M1085</link>
      <description>&lt;P&gt;My actual event looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"12345","App-A","Business-unit-A","1114052","30 Dec 2016 Static","static","2017-01-02 10:41:20+00:00","2017-01-02 10:39:51+00:00","147294802","106822","2016-12-14 10:19:58+00:00","3","117","Improper Output Neutralization for Logs","true","2","Open","Not Mitigated","1","appname-1.0-SNAPSHOT.war","filename.java","107"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The field used to create the event _time is the second UTC date, in this case 2017-01-02 10:39:51+00:00. though I'm not really sure that matters?&lt;/P&gt;

&lt;P&gt;I also don't think your solution will work for months where the 'name' does not appear in any events. For example, using the data in my original question, I need App-A to be included in the calculation for May even though it does not have any events in May.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Nov 2017 11:57:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Sum-of-maximum-value-of-field-up-to-point-in-time-over-time/m-p/366752#M1085</guid>
      <dc:creator>ccampbellveraco</dc:creator>
      <dc:date>2017-11-11T11:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of maximum value of field up to point in time, over time</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Sum-of-maximum-value-of-field-up-to-point-in-time-over-time/m-p/366753#M1086</link>
      <description>&lt;P&gt;There are many ways to do it . Try this as well&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=your_index  | stats max(Amount) as Amount by Name date_year date_month| stats sum(Amount) As total_count by date_year date_month | eval date=date_year+"-"+date_month | fields date total_count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 11 Nov 2017 12:01:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Sum-of-maximum-value-of-field-up-to-point-in-time-over-time/m-p/366753#M1086</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2017-11-11T12:01:22Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of maximum value of field up to point in time, over time</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Sum-of-maximum-value-of-field-up-to-point-in-time-over-time/m-p/366754#M1087</link>
      <description>&lt;P&gt;That doesn't work either. If I run that right now on a subset of my data, I get no column for November as the data has no events in November, even though we are currently in November.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Nov 2017 12:14:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Sum-of-maximum-value-of-field-up-to-point-in-time-over-time/m-p/366754#M1087</guid>
      <dc:creator>ccampbellveraco</dc:creator>
      <dc:date>2017-11-11T12:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of maximum value of field up to point in time, over time</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Sum-of-maximum-value-of-field-up-to-point-in-time-over-time/m-p/366755#M1088</link>
      <description>&lt;P&gt;Just to show the output of your suggestion:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2017-april  2177462145
2017-august 2939451426
2017-february   1670151484
2017-january    1300279191
2017-july   2779289387
2017-june   2617983671
2017-march  2572205729
2017-may    2366115019
2017-november   3871717110
2017-october    4344131497
2017-september  3043633510
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;November should be the highest value but it's not.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Nov 2017 12:18:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Sum-of-maximum-value-of-field-up-to-point-in-time-over-time/m-p/366755#M1088</guid>
      <dc:creator>ccampbellveraco</dc:creator>
      <dc:date>2017-11-11T12:18:46Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of maximum value of field up to point in time, over time</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Sum-of-maximum-value-of-field-up-to-point-in-time-over-time/m-p/366756#M1089</link>
      <description>&lt;P&gt;I finally figured this out using the &lt;CODE&gt;filldown&lt;/CODE&gt; command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search... | streamstats max(Amount) as Biggest_Amount by Name | timechart max(Biggest_Amount) as Biggest_Amount by Name where top1000 | filldown | addtotals | fields _time Total
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Nov 2017 18:58:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Sum-of-maximum-value-of-field-up-to-point-in-time-over-time/m-p/366756#M1089</guid>
      <dc:creator>ccampbellveraco</dc:creator>
      <dc:date>2017-11-13T18:58:23Z</dc:date>
    </item>
  </channel>
</rss>

