<?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 use the difference between multiple field values to create a new field in Splunk? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-use-the-difference-between-multiple-field-values-to/m-p/426471#M74762</link>
    <description>&lt;P&gt;@russell120 , did you try this? are you getting expected output?&lt;/P&gt;</description>
    <pubDate>Tue, 16 Oct 2018 13:37:48 GMT</pubDate>
    <dc:creator>493669</dc:creator>
    <dc:date>2018-10-16T13:37:48Z</dc:date>
    <item>
      <title>How do I use the difference between multiple field values to create a new field in Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-use-the-difference-between-multiple-field-values-to/m-p/426467#M74758</link>
      <description>&lt;P&gt;I have an example lookup file below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Week           Site_Visits                   
Week1Oct          500
Week2Oct          1300
Week3Oct          400
Week4Oct          2100
Week1Sep          1400
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How do I create a new field to show the differences between each &lt;CODE&gt;Site_Visit&lt;/CODE&gt; value against the first one ( &lt;CODE&gt;500&lt;/CODE&gt;)? Each week I will be adding a new row of data, so it should be scalable. It should look like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Week           Site_Visits         Progress           
Week1Oct          500                 0     
Week2Oct         1300                800 
Week3Oct          400               -100
Week4Oct         2100               1700
Week1Sep         1400               1100
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Oct 2018 17:38:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-use-the-difference-between-multiple-field-values-to/m-p/426467#M74758</guid>
      <dc:creator>russell120</dc:creator>
      <dc:date>2018-10-15T17:38:52Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the difference between multiple field values to create a new field in Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-use-the-difference-between-multiple-field-values-to/m-p/426468#M74759</link>
      <description>&lt;P&gt;Hi @russell120,&lt;BR /&gt;
try this :-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eventstats first(Site_Visits) as first|eval progress=Site_Visits-first|fields - first
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;try this run anywhere example as per your sample data-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults |eval week="Week1Oct", Site_Visits =500
|append[| makeresults |eval week="Week2Oct", Site_Visits =1300]
|append[| makeresults |eval week="Week3Oct", Site_Visits =400]
|append[| makeresults |eval week="Week4Oct", Site_Visits =2100]
|append[| makeresults |eval week="Week5Oct", Site_Visits =1400]
|eventstats first(Site_Visits) as first|eval progress=Site_Visits-first|fields - first
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Oct 2018 17:55:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-use-the-difference-between-multiple-field-values-to/m-p/426468#M74759</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-10-15T17:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the difference between multiple field values to create a new field in Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-use-the-difference-between-multiple-field-values-to/m-p/426469#M74760</link>
      <description>&lt;P&gt;You would use Splunk &lt;CODE&gt;delta&lt;/CODE&gt; command for this. Read this for more information&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/7.2.0/SearchReference/Delta"&gt;http://docs.splunk.com/Documentation/Splunk/7.2.0/SearchReference/Delta&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Usage:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your current search with fields Week and Site_Visits
| delta Site_Visits as Progress
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Oct 2018 18:44:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-use-the-difference-between-multiple-field-values-to/m-p/426469#M74760</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-10-15T18:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the difference between multiple field values to create a new field in Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-use-the-difference-between-multiple-field-values-to/m-p/426470#M74761</link>
      <description>&lt;P&gt;&lt;CODE&gt;|delta Site_Visits as Progress&lt;/CODE&gt; returned the difference between each &lt;CODE&gt;Site_Visits&lt;/CODE&gt; value and &lt;EM&gt;the Site_Visits value before directly before it&lt;/EM&gt;. It did not return the difference between each &lt;CODE&gt;Site_Visits&lt;/CODE&gt; value and the &lt;EM&gt;very first Site_Visits values&lt;/EM&gt;, which in this case is 500. I need a field that returns 1300-500, 400-500, 2100-500, etc.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Oct 2018 19:21:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-use-the-difference-between-multiple-field-values-to/m-p/426470#M74761</guid>
      <dc:creator>russell120</dc:creator>
      <dc:date>2018-10-15T19:21:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the difference between multiple field values to create a new field in Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-use-the-difference-between-multiple-field-values-to/m-p/426471#M74762</link>
      <description>&lt;P&gt;@russell120 , did you try this? are you getting expected output?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Oct 2018 13:37:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-use-the-difference-between-multiple-field-values-to/m-p/426471#M74762</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-10-16T13:37:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the difference between multiple field values to create a new field in Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-use-the-difference-between-multiple-field-values-to/m-p/426472#M74763</link>
      <description>&lt;P&gt;@493669 I did, and I don't think its compatible with my query. My query is here: &lt;A href="https://answers.splunk.com/answers/692485/how-to-populate-a-new-field-with-the-differences-o.html"&gt;https://answers.splunk.com/answers/692485/how-to-populate-a-new-field-with-the-differences-o.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;It creates a table that looks the same as my question above but with different field names.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Oct 2018 16:36:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-use-the-difference-between-multiple-field-values-to/m-p/426472#M74763</guid>
      <dc:creator>russell120</dc:creator>
      <dc:date>2018-10-16T16:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use the difference between multiple field values to create a new field in Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-use-the-difference-between-multiple-field-values-to/m-p/426473#M74764</link>
      <description>&lt;P&gt;EDIT: |eventstats first(Site_Visits) as first|eval progress=Site_Visits-first|fields - first&lt;/P&gt;

&lt;P&gt;This is the line that made it work. Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:40:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-use-the-difference-between-multiple-field-values-to/m-p/426473#M74764</guid>
      <dc:creator>russell120</dc:creator>
      <dc:date>2020-09-29T21:40:17Z</dc:date>
    </item>
  </channel>
</rss>

