<?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 calculate values in two fields ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-values-in-two-fields/m-p/524784#M148037</link>
    <description>&lt;P&gt;I thought the autoregress would be dynamic - it isn't. Try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval change=IN-OUT
| streamstats sum(change) as f3&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 15 Oct 2020 07:38:25 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2020-10-15T07:38:25Z</dc:date>
    <item>
      <title>How to calculate values in two fields ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-values-in-two-fields/m-p/524610#M147970</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;My issue is I have a table like that :&lt;/P&gt;&lt;TABLE border="1" width="48.03718856820387%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="15.891472868217054%" height="24px"&gt;field 1&lt;/TD&gt;&lt;TD width="32.17054263565892%" height="24px"&gt;field 2&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="15.891472868217054%" height="24px"&gt;1&lt;/TD&gt;&lt;TD width="32.17054263565892%" height="24px"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="15.891472868217054%" height="24px"&gt;2&lt;/TD&gt;&lt;TD width="32.17054263565892%" height="24px"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="15.891472868217054%" height="24px"&gt;2&lt;/TD&gt;&lt;TD width="32.17054263565892%" height="24px"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="15.891472868217054%"&gt;1&lt;/TD&gt;&lt;TD width="32.17054263565892%"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create an third column that create the result of :&lt;/P&gt;&lt;P&gt;first line = field1 - field2=field3&lt;/P&gt;&lt;P&gt;second line = first line field3&amp;nbsp;&lt;STRONG&gt;+&lt;/STRONG&gt; second line field1 -&amp;nbsp; second line field2=new field3&lt;/P&gt;&lt;P&gt;third line = second line field3&amp;nbsp;&lt;STRONG&gt;+&lt;/STRONG&gt; third line field1 -&amp;nbsp; third line field2=new field3&lt;/P&gt;&lt;P&gt;etc...&lt;/P&gt;&lt;TABLE border="1" width="316px"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="82.4px" height="24px"&gt;field 1&lt;/TD&gt;&lt;TD width="120.8px" height="24px"&gt;field 2&lt;/TD&gt;&lt;TD width="112px"&gt;field 3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="82.4px" height="24px"&gt;1&lt;/TD&gt;&lt;TD width="120.8px" height="24px"&gt;0&lt;/TD&gt;&lt;TD width="112px"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="82.4px" height="24px"&gt;2&lt;/TD&gt;&lt;TD width="120.8px" height="24px"&gt;1&lt;/TD&gt;&lt;TD width="112px"&gt;2 (1+2-1)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="82.4px" height="24px"&gt;1&lt;/TD&gt;&lt;TD width="120.8px" height="24px"&gt;2&lt;/TD&gt;&lt;TD width="112px"&gt;1 (2+1-2)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="82.4px"&gt;1&lt;/TD&gt;&lt;TD width="120.8px"&gt;0&lt;/TD&gt;&lt;TD width="112px"&gt;2 (1+1-0)&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you help me ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2020 14:54:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-values-in-two-fields/m-p/524610#M147970</guid>
      <dc:creator>mah</dc:creator>
      <dc:date>2020-10-14T14:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate values in two fields ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-values-in-two-fields/m-p/524684#M147990</link>
      <description>&lt;LI-CODE lang="markup"&gt;| autoregress field_3
| fillnull value=0 field_3_p1
| eval field_3=field_3_p1+field_1-field_2&lt;/LI-CODE&gt;&lt;P&gt;The fillnull may be redundant&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2020 16:42:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-values-in-two-fields/m-p/524684#M147990</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-10-14T16:42:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate values in two fields ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-values-in-two-fields/m-p/524779#M148033</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;the result is wrong :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mah_0-1602746220634.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11300i99B89CB169204742/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mah_0-1602746220634.png" alt="mah_0-1602746220634.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You can see that the field_3 is not correct because it must be &lt;STRONG&gt;LAST&lt;/STRONG&gt; field_3+field IN - field OUT&lt;/P&gt;&lt;P&gt;the field_3 here just calculate field IN - field OUT.&lt;/P&gt;&lt;P&gt;example of line 5 : -2 (last field_3)+4-0=2 and not 4&lt;/P&gt;&lt;P&gt;Can we do that ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2020 07:22:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-values-in-two-fields/m-p/524779#M148033</guid>
      <dc:creator>mah</dc:creator>
      <dc:date>2020-10-15T07:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate values in two fields ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-values-in-two-fields/m-p/524781#M148035</link>
      <description>&lt;P&gt;Please share the query you used to get this result&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2020 07:25:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-values-in-two-fields/m-p/524781#M148035</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-10-15T07:25:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate values in two fields ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-values-in-two-fields/m-p/524783#M148036</link>
      <description>&lt;P&gt;I just add your commands after my chart command :&amp;nbsp;&lt;/P&gt;&lt;P&gt;| chart count(user) over _time by type&lt;BR /&gt;| autoregress field_3&lt;BR /&gt;| fillnull value=0 field_3_p1&lt;BR /&gt;| eval field_3=field_3_p1+IN-OUT&lt;/P&gt;&lt;P&gt;result :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mah_0-1602747003390.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/11301iD0061F5F9A08684C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mah_0-1602747003390.png" alt="mah_0-1602747003390.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2020 07:30:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-values-in-two-fields/m-p/524783#M148036</guid>
      <dc:creator>mah</dc:creator>
      <dc:date>2020-10-15T07:30:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate values in two fields ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-values-in-two-fields/m-p/524784#M148037</link>
      <description>&lt;P&gt;I thought the autoregress would be dynamic - it isn't. Try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval change=IN-OUT
| streamstats sum(change) as f3&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 15 Oct 2020 07:38:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-values-in-two-fields/m-p/524784#M148037</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-10-15T07:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate values in two fields ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-values-in-two-fields/m-p/524785#M148038</link>
      <description>&lt;P&gt;It is perfect !&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you !&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2020 07:46:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-calculate-values-in-two-fields/m-p/524785#M148038</guid>
      <dc:creator>mah</dc:creator>
      <dc:date>2020-10-15T07:46:08Z</dc:date>
    </item>
  </channel>
</rss>

