<?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: Group my data per week in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Group-my-data-per-week/m-p/353976#M104765</link>
    <description>&lt;P&gt;Hello! &lt;BR /&gt;
Try this run anywhere command&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval opened_at = "9/01/2018 12:23:35" 
| eval created_at=strptime(opened_at,"%d/%m/%Y %H:%M:%S") 
| eval Month=strftime(created_at,"%b/%Y") 
| eval date_month=strftime(created_at,"%m") 
| eval date_year=strftime(created_at,"%Y") 
| eval epoch = strptime(opened_at,"%d/%m/%Y %H:%M:%S") 
| eval week=strftime(created_at, "%w") 
| eval diff = (now() - epoch)/60 
| where diff &amp;lt; 131400 
| stats count(eval(u_service_req="true")) as "Number of SRs", count(eval(u_service_req!="true")) as "No. of Incidents", count(ticket_number) as "Total" by week Month date_month date_year 
| sort+ date_year date_month 
| fields- date_year date_month
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
    <pubDate>Thu, 15 Mar 2018 05:38:09 GMT</pubDate>
    <dc:creator>bangalorep</dc:creator>
    <dc:date>2018-03-15T05:38:09Z</dc:date>
    <item>
      <title>Group my data per week</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-my-data-per-week/m-p/353974#M104763</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;I am currently having trouble in grouping my data per week. My search is currently configured to be in a relative time range (3 months ago), connected to service now and the date that I use is on the field opened_at. Only data that has a date in its opened_at within 3 months ago should only be fetched. I had successfully grouped them by month and year but I am having trouble in grouping them per week. Is it possible to group them by week? Please see details below. Thank you.&lt;/P&gt;

&lt;P&gt;Current setup of the table.&lt;BR /&gt;
Month       No. of SRs      No. of INCs       Total&lt;BR /&gt;
Dec/2017  172                    99                     271&lt;BR /&gt;&lt;BR /&gt;
Jan/2018  543                     243                   788&lt;BR /&gt;&lt;BR /&gt;
Feb/2018  439                     213                  654&lt;BR /&gt;&lt;BR /&gt;
Mar/2018  160                    105                  265  &lt;/P&gt;

&lt;P&gt;My current query:&lt;BR /&gt;
...search|&lt;BR /&gt;
| eval created_at=strptime(opened_at,"%d/%m/%Y %H:%M:%S") &lt;BR /&gt;
| eval Month=strftime(created_at,"%b/%Y") &lt;BR /&gt;
| eval date_month=strftime(created_at,"%m") &lt;BR /&gt;
| eval date_year=strftime(created_at,"%Y") &lt;BR /&gt;
| eval epoch = strptime(opened_at,"%d/%m/%Y %H:%M:%S") &lt;BR /&gt;
| eval diff = (now() - epoch)/60 &lt;BR /&gt;
| where diff &amp;lt; 131400 &lt;BR /&gt;
| stats count(eval(u_service_req="true")) as "Number of SRs", count(eval(u_service_req!="true")) as "No. of Incidents", count(ticket_number) as "Total" by Month date_month date_year &lt;BR /&gt;
| sort+ date_year date_month | fields- date_year date_month&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:29:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-my-data-per-week/m-p/353974#M104763</guid>
      <dc:creator>NicoloPunzalan2</dc:creator>
      <dc:date>2020-09-29T18:29:52Z</dc:date>
    </item>
    <item>
      <title>Re: Group my data per week</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-my-data-per-week/m-p/353975#M104764</link>
      <description>&lt;P&gt;Can you try something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval week=strftime(created_at, "%Y-%U")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And then also group by week.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2018 05:25:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-my-data-per-week/m-p/353975#M104764</guid>
      <dc:creator>p_gurav</dc:creator>
      <dc:date>2018-03-15T05:25:35Z</dc:date>
    </item>
    <item>
      <title>Re: Group my data per week</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-my-data-per-week/m-p/353976#M104765</link>
      <description>&lt;P&gt;Hello! &lt;BR /&gt;
Try this run anywhere command&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval opened_at = "9/01/2018 12:23:35" 
| eval created_at=strptime(opened_at,"%d/%m/%Y %H:%M:%S") 
| eval Month=strftime(created_at,"%b/%Y") 
| eval date_month=strftime(created_at,"%m") 
| eval date_year=strftime(created_at,"%Y") 
| eval epoch = strptime(opened_at,"%d/%m/%Y %H:%M:%S") 
| eval week=strftime(created_at, "%w") 
| eval diff = (now() - epoch)/60 
| where diff &amp;lt; 131400 
| stats count(eval(u_service_req="true")) as "Number of SRs", count(eval(u_service_req!="true")) as "No. of Incidents", count(ticket_number) as "Total" by week Month date_month date_year 
| sort+ date_year date_month 
| fields- date_year date_month
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2018 05:38:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-my-data-per-week/m-p/353976#M104765</guid>
      <dc:creator>bangalorep</dc:creator>
      <dc:date>2018-03-15T05:38:09Z</dc:date>
    </item>
  </channel>
</rss>

