<?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: timechart output - drop most recent week in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-timechart-output-that-drops-most-recent-week-but/m-p/605144#M210452</link>
    <description>&lt;LI-CODE lang="markup"&gt;| where _time &amp;lt; relative_time(now(),"@w")&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 11 Jul 2022 12:47:33 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2022-07-11T12:47:33Z</dc:date>
    <item>
      <title>How to write timechart output that drops most recent week but keeps in the initial query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-timechart-output-that-drops-most-recent-week-but/m-p/604867#M210361</link>
      <description>&lt;P&gt;I have a query that must search 9 weeks of data, and then applies a filter against a single field (dv_opened_at) looking for specific events that occurred within an 8 week period.&amp;nbsp; Initial 9 week search is necessary to catch events that were modified after the end of the last week, yet had a dv_modified_at time within the last 8 weeks.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;query&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=cmdb (dv_number=* OR number=*)  dv_state=* dv_assigned_to[| inputlookup cmdb_users.csv| table dv_assigned_to ] earliest=-8w@w latest=now()
        | table _time number dv_number dv_opened_at dv_assigned_to dv_short_description dv_watch_list dv_sys_updated_on dv_state close_notes | dedup number
| eval dv_opened_at=strptime(dv_opened_at,"%Y-%m-%d %H:%M:%S") 
| where dv_opened_at&amp;gt;=relative_time(now(), "-8w@w") AND dv_opened_at&amp;lt;=relative_time(now(), "@w")
| eval _time=dv_opened_at
| bin _time span=1w
| eval weeknumber=strftime(_time,"%U")
| rename dv_assigned_to AS Analyst
| timechart limit=0 useother=false span=1w count BY Analyst&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The problem is, the timechart outputs 9 weeks of data, and as expected the last week is all 0's.&amp;nbsp; How do I eliminate the current week from the output, but keep the current week in the initial query?&lt;/P&gt;
&lt;P&gt;Output&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;_time	    Analyst1 Analyst2 Analyst3 Analyst4
2022-05-08 	19      6       0         0
2022-05-15	5       4       0         0
2022-05-22	8       2       0         1
2022-05-29	7       4       0         0
2022-06-05	1       3       1         39
2022-06-12	7       1       4         51
2022-06-19	3       2       0         59
2022-06-26	25      5       2         26
2022-07-03	0       0       0         0 #how to drop this row each weekly report&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2022 14:40:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-timechart-output-that-drops-most-recent-week-but/m-p/604867#M210361</guid>
      <dc:creator>tlmayes</dc:creator>
      <dc:date>2022-07-08T14:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: timechart output - drop most recent week</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-timechart-output-that-drops-most-recent-week-but/m-p/604875#M210362</link>
      <description>&lt;P&gt;Just filter out the empty row. Something like&lt;/P&gt;&lt;PRE&gt;| where _time &amp;lt;now()-7*86400&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Jul 2022 04:40:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-timechart-output-that-drops-most-recent-week-but/m-p/604875#M210362</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-07-08T04:40:10Z</dc:date>
    </item>
    <item>
      <title>Re: timechart output - drop most recent week</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-timechart-output-that-drops-most-recent-week-but/m-p/604878#M210363</link>
      <description>&lt;P&gt;timechart uses earliest and latest to determine what time range to use - update these on your search line to snap to the beginning of the week&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;... earliest=-8w@w latest=@w&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 08 Jul 2022 05:12:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-timechart-output-that-drops-most-recent-week-but/m-p/604878#M210363</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-07-08T05:12:21Z</dc:date>
    </item>
    <item>
      <title>Re: timechart output - drop most recent week</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-timechart-output-that-drops-most-recent-week-but/m-p/605141#M210449</link>
      <description>&lt;P&gt;cannot do this since doing so would eliminate the present week in the query.&amp;nbsp; Weird, but I need the present week in the query, but not in the output.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2022 12:30:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-timechart-output-that-drops-most-recent-week-but/m-p/605141#M210449</guid>
      <dc:creator>tlmayes</dc:creator>
      <dc:date>2022-07-11T12:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: timechart output - drop most recent week</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-timechart-output-that-drops-most-recent-week-but/m-p/605144#M210452</link>
      <description>&lt;LI-CODE lang="markup"&gt;| where _time &amp;lt; relative_time(now(),"@w")&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 11 Jul 2022 12:47:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-timechart-output-that-drops-most-recent-week-but/m-p/605144#M210452</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-07-11T12:47:33Z</dc:date>
    </item>
    <item>
      <title>Re: timechart output - drop most recent week</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-timechart-output-that-drops-most-recent-week-but/m-p/605150#M210454</link>
      <description>&lt;P&gt;Exactly.&amp;nbsp; This is what I was looking for.&amp;nbsp; Tried other variations but could not make it work.&amp;nbsp; Yours did.&amp;nbsp; Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2022 13:51:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-timechart-output-that-drops-most-recent-week-but/m-p/605150#M210454</guid>
      <dc:creator>tlmayes</dc:creator>
      <dc:date>2022-07-11T13:51:03Z</dc:date>
    </item>
  </channel>
</rss>

