<?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: calculating values in new rows/columns and appending based on values in existing rows/columns in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/calculating-values-in-new-rows-columns-and-appending-based-on/m-p/114069#M30114</link>
    <description>&lt;P&gt;tks too easy &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 09 Jul 2015 03:11:53 GMT</pubDate>
    <dc:creator>HattrickNZ</dc:creator>
    <dc:date>2015-07-09T03:11:53Z</dc:date>
    <item>
      <title>calculating values in new rows/columns and appending based on values in existing rows/columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/calculating-values-in-new-rows-columns-and-appending-based-on/m-p/114067#M30112</link>
      <description>&lt;P&gt;I have something like this in the stats view in splunk. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;field   NE1 NE1-L   NE2 NE2-1   field-alt
KPI1    30251   125000  22761   126000  KPI1-alt
KPI2    8809    38000   5875    38000   KPI2-alt
KPI3    212130  300000  229172  300000  KPI3-alt
KPI4    107965  160000  111798  160000  KPI4-alt
KPI5    83045   100000  42984   60000   KPI5-alt
KPI6    83229   100000  43081   60000   KPI6-alt
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;the query is rather long and contrived and looks something like: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=core host=... | 
stats  ... | untable userLabel field value | xyseries field userLabel value | 
appendcols [
search index=core ... | 
stats max| 
untable subname field value | 
xyseries field subname value | 
rename field as field1 | 
]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I want to do is add further columns to the right that are basically doing a arithmetic operation on the values in the row/columns to the left, giving something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;field   NE1 NE1-L   NE2 NE2-1   field-alt   field2      filed3
KPI1    30251   125000  22761   126000  KPI1-alt    NE1/NE1-L   NE2/NE2-L
KPI2    8809    38000   5875    38000   KPI2-alt    NE1/NE1-L   NE2/NE2-L
KPI3    212130  300000  229172  300000  KPI3-alt    NE1/NE1-L   NE2/NE2-L
KPI4    107965  160000  111798  160000  KPI4-alt    NE1/NE1-L   NE2/NE2-L
KPI5    83045   100000  42984   60000   KPI5-alt    NE1/NE1-L   NE2/NE2-L
KPI6    83229   100000  43081   60000   KPI6-alt    NE1/NE1-L   NE2/NE2-L
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How Can I achieve this? &lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2015 02:35:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/calculating-values-in-new-rows-columns-and-appending-based-on/m-p/114067#M30112</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2015-07-09T02:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: calculating values in new rows/columns and appending based on values in existing rows/columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/calculating-values-in-new-rows-columns-and-appending-based-on/m-p/114068#M30113</link>
      <description>&lt;P&gt;You can add this to the end of your search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval field2 = NE1/'NE1-L' | eval field3 = NE2/'NE2-L'
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note, you have to single-quote fields that contain a minus sign to avoid Splunk trying to subtract &lt;CODE&gt;L&lt;/CODE&gt; from &lt;CODE&gt;NE1&lt;/CODE&gt;... try not using fields that contain operators in their name to ease further computing.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2015 02:44:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/calculating-values-in-new-rows-columns-and-appending-based-on/m-p/114068#M30113</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2015-07-09T02:44:56Z</dc:date>
    </item>
    <item>
      <title>Re: calculating values in new rows/columns and appending based on values in existing rows/columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/calculating-values-in-new-rows-columns-and-appending-based-on/m-p/114069#M30114</link>
      <description>&lt;P&gt;tks too easy &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2015 03:11:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/calculating-values-in-new-rows-columns-and-appending-based-on/m-p/114069#M30114</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2015-07-09T03:11:53Z</dc:date>
    </item>
  </channel>
</rss>

