<?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 create a new column with incremental change based on another column? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-new-column-with-incremental-change-based-on/m-p/431414#M123316</link>
    <description>&lt;P&gt;Thank you very much. Its very neat. I am little worried about if the sample is not sequential as shown above and is something like 1,1,2,4,4,4,8,8,9,9,9,6,1,2, then difference could make it little more tricky.&lt;/P&gt;

&lt;P&gt;with best regards&lt;BR /&gt;
karan  &lt;/P&gt;</description>
    <pubDate>Thu, 30 Aug 2018 13:57:50 GMT</pubDate>
    <dc:creator>KChaudhary</dc:creator>
    <dc:date>2018-08-30T13:57:50Z</dc:date>
    <item>
      <title>How do I create a new column with incremental change based on another column?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-new-column-with-incremental-change-based-on/m-p/431412#M123314</link>
      <description>&lt;P&gt;Hello everyone, I am new to Splunk world and stuck with a query. Can you please help me find the solution for following problem.&lt;BR /&gt;
I am trying to create a new column with a value which is increased by 1, if there is any change in limit column. &lt;/P&gt;

&lt;P&gt;Here is the code that I tried :-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| sort localisation _time 
| streamstats range(_time) as Duration window=2 
| eval Duration1 = Duration/60 
| eval limit = if(Duration1 &amp;lt; 1,1,2) 
| autoregress limit as limit_old | eval change=0 | autoregress change as change_old | eval change = if(limit=limit_old, change_old,change_old+1) | table limit change
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;"Changes i get" is the column which is getting populated and "Expected changes" is what i am looking for. Every time the value in limit column changes, i want the column to increase values by 1 or else stay the same.&lt;/P&gt;

&lt;P&gt;I tried the answer from this  &lt;A href="https://answers.splunk.com/answers/675583/how-to-increment-the-field-based-on-the-previous-v-1.html?utm_source=typeahead&amp;amp;utm_medium=newquestion&amp;amp;utm_campaign=no_votes_sort_relev"&gt;Post&lt;/A&gt;   but its is not working for me&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Limit   Change I get    ExpectedChange
1       0
1   0   0
2   1   1
2   0   1
1   1   2
2   1   3
1   1   4
2   1   5
1   1   6
2   1   7
1   1   8
2   1   9
2   0   9
2   0   9
2   0   9
2   0   9
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thank you in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Aug 2018 13:29:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-new-column-with-incremental-change-based-on/m-p/431412#M123314</guid>
      <dc:creator>KChaudhary</dc:creator>
      <dc:date>2018-08-27T13:29:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a new column with incremental change based on another column?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-new-column-with-incremental-change-based-on/m-p/431413#M123315</link>
      <description>&lt;P&gt;Hello @KChaudhary,&lt;/P&gt;

&lt;P&gt;here is the answer:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval sample="1,1,2,2,1,2,1,2,1,2,1,2,2,2,2,2"
| makemv delim="," sample
| mvexpand sample
| delta sample as diff
| eval diff=abs(diff)
| fillnull diff 
| accum diff as cum
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Aug 2018 16:12:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-new-column-with-incremental-change-based-on/m-p/431413#M123315</guid>
      <dc:creator>poete</dc:creator>
      <dc:date>2018-08-29T16:12:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a new column with incremental change based on another column?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-new-column-with-incremental-change-based-on/m-p/431414#M123316</link>
      <description>&lt;P&gt;Thank you very much. Its very neat. I am little worried about if the sample is not sequential as shown above and is something like 1,1,2,4,4,4,8,8,9,9,9,6,1,2, then difference could make it little more tricky.&lt;/P&gt;

&lt;P&gt;with best regards&lt;BR /&gt;
karan  &lt;/P&gt;</description>
      <pubDate>Thu, 30 Aug 2018 13:57:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-a-new-column-with-incremental-change-based-on/m-p/431414#M123316</guid>
      <dc:creator>KChaudhary</dc:creator>
      <dc:date>2018-08-30T13:57:50Z</dc:date>
    </item>
  </channel>
</rss>

