<?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 to add a table column that does operations in each cell based on the values from another column2? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-table-column-that-does-operations-in-each-cell/m-p/271443#M81707</link>
    <description>&lt;P&gt;I did not say it was identical; it provides similar capability that can be exploited.  The &lt;CODE&gt;window&lt;/CODE&gt; option is actually more flexible but takes more adjustment.  You definitely should NOT be using &lt;CODE&gt;values&lt;/CODE&gt; as indicated by the fact that none of the rest of us are using it.  Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|noop|stats count AS a|eval a="1:4:7"|makemv delim=":" a|mvexpand a|eval b=a+1|eval c=b+1
| rename Comment AS "above is for spoofing fake data; below is the solution"
| streamstats first(c) as d current=f window=2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Yes, I know it isn't exactly the same but the proof of concept is there.&lt;/P&gt;</description>
    <pubDate>Mon, 04 Apr 2016 12:29:05 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2016-04-04T12:29:05Z</dc:date>
    <item>
      <title>How to add a table column that does operations in each cell based on the values from another column2?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-table-column-that-does-operations-in-each-cell/m-p/271435#M81699</link>
      <description>&lt;P&gt;asked a similar question &lt;A href="https://answers.splunk.com/answers/368616/how-to-add-a-table-column-that-does-operations-in.html"&gt;here&lt;/A&gt; but here it is slightly different and here &lt;/P&gt;

&lt;P&gt;if I have a search that gives me something like this:&lt;/P&gt;

&lt;P&gt;a b c &lt;BR /&gt;
 1 2 3&lt;BR /&gt;
 4 5 6&lt;BR /&gt;
 7 8 9 &lt;BR /&gt;
how do I add a column d that would do an operation (9/6)-1= 0.5 working on column c. ideally I am looking to get the percentage value be it 0.5, 50 or 50%.&lt;/P&gt;

&lt;P&gt;a b c d&lt;BR /&gt;&lt;BR /&gt;
 1 2 3 (3/0)-1=Na&lt;BR /&gt;
 4 5 6 (6/3)-1= 1&lt;BR /&gt;
 7 8 9 (9/6)-1= 0.5&lt;/P&gt;

&lt;P&gt;I am not sure if using delta here is the best way to go. Or should I use head or tail? &lt;/P&gt;

&lt;P&gt;here is a test search I am working with &lt;BR /&gt;
&lt;CODE&gt;| makeresults count=3 | streamstats count as a | eval a=a+1 | streamstats count as b | eval b=b+10 | streamstats count as c | eval c=c+11  | delta a as a_dif p=1 |&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Can anyone advise?&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2016 02:16:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-table-column-that-does-operations-in-each-cell/m-p/271435#M81699</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2016-04-01T02:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a table column that does operations in each cell based on the values from another column2?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-table-column-that-does-operations-in-each-cell/m-p/271436#M81700</link>
      <description>&lt;P&gt;not sure if i have to use streamstats&lt;BR /&gt;
&lt;CODE&gt;| makeresults count=3 | streamstats count as a | eval a=a+1 | streamstats count as b | eval b=b+10 | streamstats count as c | eval c=c+11  | delta a as a_dif p=1 | streamstats values(a) as a_vals&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2016 02:48:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-table-column-that-does-operations-in-each-cell/m-p/271436#M81700</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2016-04-01T02:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a table column that does operations in each cell based on the values from another column2?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-table-column-that-does-operations-in-each-cell/m-p/271437#M81701</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your search here
| streamstats values(c) as d window=1 current=f
| eval d = c/d - 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can then use fillnull for those Na values you don't want to display as blank&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2016 09:47:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-table-column-that-does-operations-in-each-cell/m-p/271437#M81701</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-04-01T09:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a table column that does operations in each cell based on the values from another column2?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-table-column-that-does-operations-in-each-cell/m-p/271438#M81702</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|noop|stats count AS a|eval a="1:4:7"|makemv delim=":" a|mvexpand a|eval b=a+1|eval c=b+1
| rename Comment AS "above is for spoofing fake data; below is the solution"
| autoregress c AS d p=1 | fillnull d value=0|eval d=round((c/d)-1,2)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 Apr 2016 17:58:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-table-column-that-does-operations-in-each-cell/m-p/271438#M81702</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-04-01T17:58:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a table column that does operations in each cell based on the values from another column2?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-table-column-that-does-operations-in-each-cell/m-p/271439#M81703</link>
      <description>&lt;P&gt;I would use &lt;CODE&gt;| streamstats current=f last(c) as d&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2016 18:00:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-table-column-that-does-operations-in-each-cell/m-p/271439#M81703</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-04-01T18:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a table column that does operations in each cell based on the values from another column2?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-table-column-that-does-operations-in-each-cell/m-p/271440#M81704</link>
      <description>&lt;P&gt;tks. is there a similar parameter as &lt;CODE&gt;p=1&lt;/CODE&gt; in the autoregress func below that controls how many values back to use, that can be used in the streamstats dexcribed here? if not autoregress is probably better as it provides that option&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2016 01:05:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-table-column-that-does-operations-in-each-cell/m-p/271440#M81704</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2016-04-04T01:05:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a table column that does operations in each cell based on the values from another column2?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-table-column-that-does-operations-in-each-cell/m-p/271441#M81705</link>
      <description>&lt;P&gt;Yes: &lt;CODE&gt;window=&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2016 01:40:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-table-column-that-does-operations-in-each-cell/m-p/271441#M81705</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-04-04T01:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a table column that does operations in each cell based on the values from another column2?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-table-column-that-does-operations-in-each-cell/m-p/271442#M81706</link>
      <description>&lt;P&gt;hmm not sure. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|noop|stats count AS a|eval a="1:4:7"|makemv delim=":" a|mvexpand a|eval b=a+1|eval c=b+1
     | rename Comment AS "above is for spoofing fake data; below is the solution" | streamstats values(c) as d current=f window=2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;give a different result to this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|noop|stats count AS a|eval a="1:4:7"|makemv delim=":" a|mvexpand a|eval b=a+1|eval c=b+1
     | rename Comment AS "above is for spoofing fake data; below is the solution"
     | autoregress c AS d p=2 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Apr 2016 02:34:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-table-column-that-does-operations-in-each-cell/m-p/271442#M81706</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2016-04-04T02:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a table column that does operations in each cell based on the values from another column2?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-table-column-that-does-operations-in-each-cell/m-p/271443#M81707</link>
      <description>&lt;P&gt;I did not say it was identical; it provides similar capability that can be exploited.  The &lt;CODE&gt;window&lt;/CODE&gt; option is actually more flexible but takes more adjustment.  You definitely should NOT be using &lt;CODE&gt;values&lt;/CODE&gt; as indicated by the fact that none of the rest of us are using it.  Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|noop|stats count AS a|eval a="1:4:7"|makemv delim=":" a|mvexpand a|eval b=a+1|eval c=b+1
| rename Comment AS "above is for spoofing fake data; below is the solution"
| streamstats first(c) as d current=f window=2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Yes, I know it isn't exactly the same but the proof of concept is there.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2016 12:29:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-table-column-that-does-operations-in-each-cell/m-p/271443#M81707</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-04-04T12:29:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a table column that does operations in each cell based on the values from another column2?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-table-column-that-does-operations-in-each-cell/m-p/271444#M81708</link>
      <description>&lt;P&gt;tks I get it with these 2 examples, which are very similar with the offseting in column d.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|noop|stats count AS a|eval a="1:4:7:8:9:10:11:12:13"|makemv delim=":" a|mvexpand a|eval b=a+1|eval c=b+1
 | rename Comment AS "above is for spoofing fake data; below is the solution"
 | streamstats first(c) as d current=f window=3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;2nd&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|noop|stats count AS a|eval a="1:4:7:8:9:10:11:12:13"|makemv delim=":" a|mvexpand a|eval b=a+1|eval c=b+1
 | rename Comment AS "above is for spoofing fake data; below is the solution"
 | autoregress c AS d p=3
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Apr 2016 19:57:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-a-table-column-that-does-operations-in-each-cell/m-p/271444#M81708</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2016-04-04T19:57:59Z</dc:date>
    </item>
  </channel>
</rss>

