<?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 can I compare data between two dates? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-data-between-two-dates/m-p/316786#M94782</link>
    <description>&lt;P&gt;yes, it work and better than my search.&lt;/P&gt;

&lt;P&gt;but how can i group by date to show how many stock up and down&lt;BR /&gt;
after your search, if i want to use transaction date , it will so no result found.&lt;/P&gt;</description>
    <pubDate>Wed, 18 Oct 2017 10:12:16 GMT</pubDate>
    <dc:creator>kennethyeung</dc:creator>
    <dc:date>2017-10-18T10:12:16Z</dc:date>
    <item>
      <title>How can I compare data between two dates?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-data-between-two-dates/m-p/316784#M94780</link>
      <description>&lt;P&gt;I have index data like below, and I want to calculate how many have a stock price higher than yesterday.&lt;BR /&gt;
date, stock, price&lt;BR /&gt;
20171016, abc, 100&lt;BR /&gt;
20171016, def, 80&lt;BR /&gt;
20171015, abc,120&lt;BR /&gt;
20171015, def, 60&lt;BR /&gt;
20171014, abc, 100&lt;BR /&gt;
20171014, def, 70&lt;/P&gt;

&lt;P&gt;My search can do that, but is any other better search to do it as well&lt;BR /&gt;
index=test &lt;BR /&gt;
| eval nexttime=strftime(relative_time(now(),"-2d") ,"%Y%m%d")&lt;/P&gt;

&lt;P&gt;|  table * &lt;BR /&gt;
|  where 'date' &amp;gt;= nexttime &lt;BR /&gt;
| eventstats avg(close) as aa by code &lt;BR /&gt;
|  eval updown = if((close &amp;gt; aa), 1,0) &lt;BR /&gt;
|  table *  |  where 'date' &amp;gt; nexttime &lt;BR /&gt;
| addcoltotals &lt;BR /&gt;
|  tail 1| table updown&lt;/P&gt;

&lt;P&gt;Also, if i want to do similar function for last 7 day, how can i do it?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2017 08:19:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-data-between-two-dates/m-p/316784#M94780</guid>
      <dc:creator>kennethyeung</dc:creator>
      <dc:date>2017-10-18T08:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: How can I compare data between two dates?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-data-between-two-dates/m-p/316785#M94781</link>
      <description>&lt;P&gt;Try this!&lt;/P&gt;

&lt;P&gt;(your search)&lt;BR /&gt;
|table date,stock,price&lt;BR /&gt;
|sort stock,date&lt;BR /&gt;
|streamstats count by stock&lt;BR /&gt;
|delta price as diff_price&lt;BR /&gt;
|eval diff_price=if(count=1,0,diff_price)&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:16:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-data-between-two-dates/m-p/316785#M94781</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2020-09-29T16:16:37Z</dc:date>
    </item>
    <item>
      <title>Re: How can I compare data between two dates?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-data-between-two-dates/m-p/316786#M94782</link>
      <description>&lt;P&gt;yes, it work and better than my search.&lt;/P&gt;

&lt;P&gt;but how can i group by date to show how many stock up and down&lt;BR /&gt;
after your search, if i want to use transaction date , it will so no result found.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2017 10:12:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-data-between-two-dates/m-p/316786#M94782</guid>
      <dc:creator>kennethyeung</dc:creator>
      <dc:date>2017-10-18T10:12:16Z</dc:date>
    </item>
    <item>
      <title>Re: How can I compare data between two dates?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-data-between-two-dates/m-p/316787#M94783</link>
      <description>&lt;P&gt;Please tell me the output image.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2017 12:53:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-data-between-two-dates/m-p/316787#M94783</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2017-10-18T12:53:25Z</dc:date>
    </item>
    <item>
      <title>Re: How can I compare data between two dates?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-data-between-two-dates/m-p/316788#M94784</link>
      <description>&lt;P&gt;i want some thing like below&lt;/P&gt;

&lt;P&gt;date, number of stock raise&lt;BR /&gt;
20171016 , 1&lt;BR /&gt;
20171015,1&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2017 15:01:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-data-between-two-dates/m-p/316788#M94784</guid>
      <dc:creator>kennethyeung</dc:creator>
      <dc:date>2017-10-18T15:01:55Z</dc:date>
    </item>
    <item>
      <title>Re: How can I compare data between two dates?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-data-between-two-dates/m-p/316789#M94785</link>
      <description>&lt;P&gt;Should diff_price count the plus?&lt;/P&gt;

&lt;P&gt;|stats count(eval(diff_price&amp;gt;0)) as updown by date&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2017 15:25:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-data-between-two-dates/m-p/316789#M94785</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2017-10-18T15:25:13Z</dc:date>
    </item>
    <item>
      <title>Re: How can I compare data between two dates?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-data-between-two-dates/m-p/316790#M94786</link>
      <description>&lt;P&gt;thanks it work as what i want, let me spend some time to play with those syntax, i am newbies in splunk&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 02:30:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-compare-data-between-two-dates/m-p/316790#M94786</guid>
      <dc:creator>kennethyeung</dc:creator>
      <dc:date>2017-10-19T02:30:32Z</dc:date>
    </item>
  </channel>
</rss>

