<?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 &amp;quot;Moving&amp;quot; sum of the last 52 weeks? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-quot-Moving-quot-sum-of-the-last-52-weeks/m-p/340686#M101035</link>
    <description>&lt;P&gt;hey I think you want something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your_base_search&amp;gt; 
| eval dateweek_year=strftime(_time,"%Y-%U") 
| chart count as Num_Incidents over dateweek_year 
| streamstats sum(Num_Incidents) as "Moving_SUM" window=52
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;So, you will get cumulative sum of last 52 weeks at any point of time.&lt;/STRONG&gt; &lt;BR /&gt;
let me know if this helps!&lt;/P&gt;</description>
    <pubDate>Wed, 31 Jan 2018 09:41:39 GMT</pubDate>
    <dc:creator>mayurr98</dc:creator>
    <dc:date>2018-01-31T09:41:39Z</dc:date>
    <item>
      <title>How to calculate the "Moving" sum of the last 52 weeks?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-quot-Moving-quot-sum-of-the-last-52-weeks/m-p/340684#M101033</link>
      <description>&lt;P&gt;Splunkers!&lt;BR /&gt;
I have a new problem I'm not able to solve, I hope you can help me...&lt;/P&gt;

&lt;P&gt;Basically, I'm counting the number of incidents occurring on weekly basis related to the last 2 years (events beginning in Jan 2016):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...
| eval dateweek_year=strftime(_time,"%Y-%U")    
| chart count as Num_Incidents over dateweek_year
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now, I'd like to present the outcome as "moving sum" of the last 52 weeks, starting from Jan 2017.&lt;BR /&gt;
So 01-2017 period has to show the sum of incidents from 02-2016 to 01-2017, &lt;BR /&gt;
02-2017 from 03-2016 to 02-2017&lt;BR /&gt;
etc...&lt;/P&gt;

&lt;P&gt;Any help?&lt;/P&gt;

&lt;P&gt;I've no clue about how to do it...&lt;/P&gt;

&lt;P&gt;Eventstats/Streamstats should help?&lt;/P&gt;

&lt;P&gt;Tks!&lt;BR /&gt;
Carmine&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2018 08:30:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-quot-Moving-quot-sum-of-the-last-52-weeks/m-p/340684#M101033</guid>
      <dc:creator>CarmineCalo</dc:creator>
      <dc:date>2018-01-31T08:30:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the "Moving" sum of the last 52 weeks?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-quot-Moving-quot-sum-of-the-last-52-weeks/m-p/340685#M101034</link>
      <description>&lt;P&gt;@CarmineCalo, Please try the following and confirm&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;YourBaseSearch&amp;gt;
| eval dateweek_year=strftime(_time,"%Y-%U")    
| chart count as Num_Incidents over dateweek_year
| accum Num_Incidents 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 Jan 2018 08:52:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-quot-Moving-quot-sum-of-the-last-52-weeks/m-p/340685#M101034</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-01-31T08:52:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the "Moving" sum of the last 52 weeks?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-quot-Moving-quot-sum-of-the-last-52-weeks/m-p/340686#M101035</link>
      <description>&lt;P&gt;hey I think you want something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your_base_search&amp;gt; 
| eval dateweek_year=strftime(_time,"%Y-%U") 
| chart count as Num_Incidents over dateweek_year 
| streamstats sum(Num_Incidents) as "Moving_SUM" window=52
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;So, you will get cumulative sum of last 52 weeks at any point of time.&lt;/STRONG&gt; &lt;BR /&gt;
let me know if this helps!&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2018 09:41:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-quot-Moving-quot-sum-of-the-last-52-weeks/m-p/340686#M101035</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-31T09:41:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the "Moving" sum of the last 52 weeks?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-quot-Moving-quot-sum-of-the-last-52-weeks/m-p/340687#M101036</link>
      <description>&lt;P&gt;This option works, great &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Tks!&lt;BR /&gt;
Carmine&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2018 11:58:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-the-quot-Moving-quot-sum-of-the-last-52-weeks/m-p/340687#M101036</guid>
      <dc:creator>CarmineCalo</dc:creator>
      <dc:date>2018-01-31T11:58:32Z</dc:date>
    </item>
  </channel>
</rss>

