<?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 do I compare distinct counts of a given field between two different time ranges within the same Splunk search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-compare-distinct-counts-of-a-given-field-between-two/m-p/200628#M58179</link>
    <description>&lt;P&gt;Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="SALESCSV" earliest="1/1/2014:00:00:00" latest="1/1/2016:00:00:00" Geography=EMEA 
| eval Period=if(_time&amp;gt;=strptime("1/1/2015","%m/%d/%Y"),"2015_Orders","2014_Orders") | chart dc(OrderNumber) over Customer by Period | eval Difference='2014_Orders'-'2015_Orders'
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 13 Apr 2016 21:43:39 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2016-04-13T21:43:39Z</dc:date>
    <item>
      <title>How do I compare distinct counts of a given field between two different time ranges within the same Splunk search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-compare-distinct-counts-of-a-given-field-between-two/m-p/200627#M58178</link>
      <description>&lt;P&gt;I have a CSV file that a list of customers and their orders.  The format is as follows:&lt;/P&gt;

&lt;P&gt;OrderDate, OrderNumber, Customer, OrderAmount&lt;/P&gt;

&lt;P&gt;Same order number can be on multiple lines because a customer can order multiple items under the same order number.&lt;BR /&gt;
Now, what I want to do is compare the order volume by customer between two years.&lt;BR /&gt;
Example output:&lt;/P&gt;

&lt;P&gt;Customer, 2014 Orders, 2015 Orders, Difference&lt;BR /&gt;
CustA, 100, 60, -40&lt;BR /&gt;
CustB, 70, 80, 10&lt;BR /&gt;
...&lt;/P&gt;

&lt;P&gt;I am trying to identify which customers have had a significant decrease in orders and which ones have had a significant increase year over year.  I've tried the following but it gives me no search results:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="SALESCSV" [search earliest="1/1/2014:00:00:00" latest="12/31/2014:23:59:59" Geography=EMEA search_name="2014 Orders"] [search earliest="1/1/2015:00:00:00" latest="12/31/2015:23:59:59" Geography=EMEA search_name="2015 Orders"] | stats dc(OrderNumber) by search_name
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Apr 2016 21:23:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-compare-distinct-counts-of-a-given-field-between-two/m-p/200627#M58178</guid>
      <dc:creator>niravshahcorero</dc:creator>
      <dc:date>2016-04-13T21:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do I compare distinct counts of a given field between two different time ranges within the same Splunk search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-compare-distinct-counts-of-a-given-field-between-two/m-p/200628#M58179</link>
      <description>&lt;P&gt;Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="SALESCSV" earliest="1/1/2014:00:00:00" latest="1/1/2016:00:00:00" Geography=EMEA 
| eval Period=if(_time&amp;gt;=strptime("1/1/2015","%m/%d/%Y"),"2015_Orders","2014_Orders") | chart dc(OrderNumber) over Customer by Period | eval Difference='2014_Orders'-'2015_Orders'
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Apr 2016 21:43:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-compare-distinct-counts-of-a-given-field-between-two/m-p/200628#M58179</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-04-13T21:43:39Z</dc:date>
    </item>
  </channel>
</rss>

