<?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: Get data for last week and current week in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-for-last-week-and-current-week/m-p/653455#M225813</link>
    <description>&lt;P&gt;I think you're overcomplicating that a bit.&lt;/P&gt;&lt;P&gt;If you just want to count by days or weeks why not starting with either&lt;/P&gt;&lt;PRE&gt;| bin _time span=1d&lt;/PRE&gt;&lt;P&gt;(or 1w)&lt;/P&gt;&lt;P&gt;And if you want to do some aggregation you could just timechart instead.&lt;/P&gt;&lt;P&gt;Anyway, even if you want to just filter, your method of calculating relative time vs relative time is a bit strange.&lt;/P&gt;</description>
    <pubDate>Mon, 07 Aug 2023 18:12:16 GMT</pubDate>
    <dc:creator>PickleRick</dc:creator>
    <dc:date>2023-08-07T18:12:16Z</dc:date>
    <item>
      <title>How to get data for last week and current week?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-for-last-week-and-current-week/m-p/653438#M225808</link>
      <description>&lt;P&gt;I have data stored in the csv file, which contains the time field. I want the data for complete last week and also the data for current week.&lt;BR /&gt;&lt;BR /&gt;Eg&lt;/P&gt;
&lt;P&gt;Day1: 100&lt;BR /&gt;day2: 200.&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;.Day14:600&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;I want data from day1-day7 -&amp;gt; Current week and day7-14 -&amp;gt; Previous week&lt;BR /&gt;&lt;BR /&gt;I am doing something like below, but it gives me data from current week&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| eval first_day_last_week=relative_time(relative_time(now(),"-1w@w"),"-1d@d"), last_day_last_week=relative_time(relative_time(now(),"-1w@w"),"+6d@d") 
| where _time&amp;gt;=first_day_last_week AND _time&amp;lt;=last_day_last_week &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;technically the data should not come up as today is the Aug 7 and it should not show as it is from current week&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="agupta13_0-1691423871567.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/26663i5C85A1046F258E01/image-size/medium?v=v2&amp;amp;px=400" role="button" title="agupta13_0-1691423871567.png" alt="agupta13_0-1691423871567.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Aug 2023 19:29:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-for-last-week-and-current-week/m-p/653438#M225808</guid>
      <dc:creator>agupta13</dc:creator>
      <dc:date>2023-08-07T19:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: Get data for last week and current week</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-for-last-week-and-current-week/m-p/653455#M225813</link>
      <description>&lt;P&gt;I think you're overcomplicating that a bit.&lt;/P&gt;&lt;P&gt;If you just want to count by days or weeks why not starting with either&lt;/P&gt;&lt;PRE&gt;| bin _time span=1d&lt;/PRE&gt;&lt;P&gt;(or 1w)&lt;/P&gt;&lt;P&gt;And if you want to do some aggregation you could just timechart instead.&lt;/P&gt;&lt;P&gt;Anyway, even if you want to just filter, your method of calculating relative time vs relative time is a bit strange.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Aug 2023 18:12:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-for-last-week-and-current-week/m-p/653455#M225813</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-08-07T18:12:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to get data for last week and current week?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-for-last-week-and-current-week/m-p/653499#M225833</link>
      <description>&lt;P&gt;As of August 8th (Australia) - the first day LAST week is 29th July and the last day last week is the 5th August - Sun-Sat. This would also be true in your case of Mon 7th August. The "Current week" is 7th-13th August.&lt;/P&gt;&lt;P&gt;Therefore the dates of the events you have are 3rd and 4th of August which is the Thu/Fri LAST week, so that data is giving what you are asking for.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2023 05:48:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-data-for-last-week-and-current-week/m-p/653499#M225833</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-08-08T05:48:09Z</dc:date>
    </item>
  </channel>
</rss>

