<?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: Can you help me create a search query that would make a dynamic comparison of yesterday's data to last week's? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-create-a-search-query-that-would-make-a-dynamic/m-p/456348#M129012</link>
    <description>&lt;P&gt;Hi @sager_shubham,&lt;/P&gt;

&lt;P&gt;did you try out Skoelpin's suggestion? Did it work? Let us know, so we can convert it to answer, and then you can approve it! Thanks.&lt;/P&gt;</description>
    <pubDate>Wed, 12 Sep 2018 19:36:58 GMT</pubDate>
    <dc:creator>mstjohn_splunk</dc:creator>
    <dc:date>2018-09-12T19:36:58Z</dc:date>
    <item>
      <title>Can you help me create a search query that would make a dynamic comparison of yesterday's data to last week's?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-create-a-search-query-that-would-make-a-dynamic/m-p/456344#M129008</link>
      <description>&lt;P&gt;I wrote the following query for today's comparison with last week:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = abc App_Name=xyz earliest=-0d@d latest=now | multikv | eval ReportKey="Today"|append[search index = abc App_Name=xyz earliest=-7d@d latest=-6d@d | multikv | eval ReportKey="LastWeek"| eval _time=_time+60*60*24*7]|eval _time=if(isnotnull(new_time), new_time, _time)|timechart span=5m sum(TOTAL_TRANSACTIONS) as Transactions by ReportKey
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want the query to do the following: allow someone to view the comparison of yesterday's data and last week's(considering yesterday to its one week data), or the "day before yesterday" to its corresponding "last week" data, and so on.&lt;/P&gt;

&lt;P&gt;So, could you please help how can i write the query for that?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 11:09:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-create-a-search-query-that-would-make-a-dynamic/m-p/456344#M129008</guid>
      <dc:creator>sagar_shubham</dc:creator>
      <dc:date>2018-09-12T11:09:39Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me create a search query that would make a dynamic comparison of yesterday's data to last week's?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-create-a-search-query-that-would-make-a-dynamic/m-p/456345#M129009</link>
      <description>&lt;P&gt;You should use &lt;CODE&gt;relative_time&lt;/CODE&gt; or &lt;CODE&gt;timewrap&lt;/CODE&gt; to do this. It will be much cleaner&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 11:55:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-create-a-search-query-that-would-make-a-dynamic/m-p/456345#M129009</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2018-09-12T11:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me create a search query that would make a dynamic comparison of yesterday's data to last week's?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-create-a-search-query-that-would-make-a-dynamic/m-p/456346#M129010</link>
      <description>&lt;P&gt;could you please refer me with an example&lt;BR /&gt;
?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 13:11:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-create-a-search-query-that-would-make-a-dynamic/m-p/456346#M129010</guid>
      <dc:creator>sagar_shubham</dc:creator>
      <dc:date>2018-09-12T13:11:46Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me create a search query that would make a dynamic comparison of yesterday's data to last week's?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-create-a-search-query-that-would-make-a-dynamic/m-p/456347#M129011</link>
      <description>&lt;P&gt;A quick and dirty way would be to use &lt;CODE&gt;timewrap&lt;/CODE&gt; like this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = abc App_Name=xyz 
| timechart span=5m sum(TOTAL_TRANSACTIONS) as Transactions by ReportKey
| timewrap 1d
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If this doesn't work then you will need to use relative time like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index = abc App_Name=xyz 
| eval today=relative_time(now(),"-d@d")
| eval yesterday=relative_time('today', "-d@d")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Sep 2018 13:47:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-create-a-search-query-that-would-make-a-dynamic/m-p/456347#M129011</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2018-09-12T13:47:42Z</dc:date>
    </item>
    <item>
      <title>Re: Can you help me create a search query that would make a dynamic comparison of yesterday's data to last week's?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-create-a-search-query-that-would-make-a-dynamic/m-p/456348#M129012</link>
      <description>&lt;P&gt;Hi @sager_shubham,&lt;/P&gt;

&lt;P&gt;did you try out Skoelpin's suggestion? Did it work? Let us know, so we can convert it to answer, and then you can approve it! Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 19:36:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-help-me-create-a-search-query-that-would-make-a-dynamic/m-p/456348#M129012</guid>
      <dc:creator>mstjohn_splunk</dc:creator>
      <dc:date>2018-09-12T19:36:58Z</dc:date>
    </item>
  </channel>
</rss>

