<?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: Comparing Dates in Results- How do I get a laterdate? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Comparing-Dates-in-Results-How-do-I-get-a-laterdate/m-p/617082#M214449</link>
    <description>&lt;P&gt;I think trying to use double wildcard (earliest(*_*) as *_*) was a mistake.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=data sector IN (Retail, Online)
| stats earliest(_time) as first_order latest(_time) as last_order by username sector
| eval first_retail = if(sector == "Retail", first_order, null())
| eval first_online = if(sector == "Online", first_order, null())
| eval last_retail = if(sector == "Retail", last_order, null())
| eval last_online = if(sector == "Online", last_order, null())
| stats earliest(first_retail) as first_retail earliest(first_online) as first_online  latest(last_retail) as last_retail latest(last_online) as last_online by username
| where first_online &amp;gt; last_retail
| convert ctime(first_retail) ctime(last_retail) ctime(first_online) ctime(last_online)&lt;/LI-CODE&gt;&lt;P&gt;To clarify: the foreach subsearch is an iteration over first_order, last_order in order to populate first_retail, first_online, last_retail, and last_online as expanded in the above. &amp;nbsp;But the double wildcard probably wouldn't work.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 14 Oct 2022 03:54:55 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2022-10-14T03:54:55Z</dc:date>
    <item>
      <title>Comparing Dates in Results- How do I get a laterdate?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-Dates-in-Results-How-do-I-get-a-laterdate/m-p/616571#M214295</link>
      <description>&lt;P&gt;Hello, I have the search built that generates the results I want. But, the goal is to also be able to track high number of online orders after someone made a retail order.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=data sector=Retail
| stats earliest(_time) as firstretailapp latest(_time) as lastretailapp by username
| join username
               [| search index=data sector=Online
                 | stats earliest(_time) as firstonlinesale latest(_time) as lastonlinesale by username]
| convert ctime(firstretailsale) ctime(lastretailsale) ctime(firstonlinesale) ctime(lastonlinesale)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;When these results populate, I can not get the firstonlinesale to be a &lt;U&gt;later date&lt;/U&gt; than the lastretailsale. I have tried | eval difference =time1-time2, and where difference &amp;gt;1 and other command searches to try and match up something but am unsuccessful.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2022 20:53:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-Dates-in-Results-How-do-I-get-a-laterdate/m-p/616571#M214295</guid>
      <dc:creator>jedimuffin</dc:creator>
      <dc:date>2022-10-10T20:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing Dates in Results- How do I get a laterdate?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-Dates-in-Results-How-do-I-get-a-laterdate/m-p/616581#M214301</link>
      <description>&lt;P&gt;Avoid expensive join. &amp;nbsp;Try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=data sector IN (Retail, Online)
| stats earliest(_time) as first_order latest(_time) as last_order by username sector
| foreach *_order
    [eval &amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;_retail = if(sector == "Retail", &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;, null())
    | eval &amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;_online = if(sector == "Online", &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;, null())]
| stats earliest(*_*) as *_* by username
| where first_online &amp;gt; last_retail
| convert ctime(first_retail) ctime(last_retail) ctime(first_online) ctime(last_online)&lt;/LI-CODE&gt;&lt;P&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2022 22:51:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-Dates-in-Results-How-do-I-get-a-laterdate/m-p/616581#M214301</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-10-10T22:51:31Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing Dates in Results- How do I get a laterdate?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-Dates-in-Results-How-do-I-get-a-laterdate/m-p/616997#M214415</link>
      <description>&lt;P&gt;thank you. But I get 0 results and I dont understand what the search is doing. Also, in the where clause, that is the first time first_online and last_retail are mentioned? I will keep working on it&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 14:35:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-Dates-in-Results-How-do-I-get-a-laterdate/m-p/616997#M214415</guid>
      <dc:creator>jedimuffin</dc:creator>
      <dc:date>2022-10-13T14:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing Dates in Results- How do I get a laterdate?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-Dates-in-Results-How-do-I-get-a-laterdate/m-p/617002#M214416</link>
      <description>&lt;PRE&gt;| stats earliest(*_*) as *_* by username&lt;/PRE&gt;&lt;P&gt;this&amp;nbsp; drops it to one column of just a list of just usernames&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 14:49:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-Dates-in-Results-How-do-I-get-a-laterdate/m-p/617002#M214416</guid>
      <dc:creator>jedimuffin</dc:creator>
      <dc:date>2022-10-13T14:49:39Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing Dates in Results- How do I get a laterdate?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-Dates-in-Results-How-do-I-get-a-laterdate/m-p/617082#M214449</link>
      <description>&lt;P&gt;I think trying to use double wildcard (earliest(*_*) as *_*) was a mistake.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=data sector IN (Retail, Online)
| stats earliest(_time) as first_order latest(_time) as last_order by username sector
| eval first_retail = if(sector == "Retail", first_order, null())
| eval first_online = if(sector == "Online", first_order, null())
| eval last_retail = if(sector == "Retail", last_order, null())
| eval last_online = if(sector == "Online", last_order, null())
| stats earliest(first_retail) as first_retail earliest(first_online) as first_online  latest(last_retail) as last_retail latest(last_online) as last_online by username
| where first_online &amp;gt; last_retail
| convert ctime(first_retail) ctime(last_retail) ctime(first_online) ctime(last_online)&lt;/LI-CODE&gt;&lt;P&gt;To clarify: the foreach subsearch is an iteration over first_order, last_order in order to populate first_retail, first_online, last_retail, and last_online as expanded in the above. &amp;nbsp;But the double wildcard probably wouldn't work.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2022 03:54:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-Dates-in-Results-How-do-I-get-a-laterdate/m-p/617082#M214449</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-10-14T03:54:55Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing Dates in Results- How do I get a laterdate?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-Dates-in-Results-How-do-I-get-a-laterdate/m-p/617177#M214480</link>
      <description>&lt;P&gt;thank you! this works except for the conditional comparison of the where clause. but, I can just export the results and go from there. Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2022 16:56:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-Dates-in-Results-How-do-I-get-a-laterdate/m-p/617177#M214480</guid>
      <dc:creator>jedimuffin</dc:creator>
      <dc:date>2022-10-14T16:56:13Z</dc:date>
    </item>
  </channel>
</rss>

