<?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: Substract values of two columns and display the difference in third column? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Substract-values-of-two-columns-and-display-the-difference-in/m-p/353579#M104658</link>
    <description>&lt;P&gt;Thank you for your explanation. @ssadanala1&lt;BR /&gt;
When I converted that field in a number those commas [,] has been removed and then my query is working fine and returning expected result.&lt;/P&gt;</description>
    <pubDate>Wed, 02 May 2018 14:46:44 GMT</pubDate>
    <dc:creator>rashidjorvee</dc:creator>
    <dc:date>2018-05-02T14:46:44Z</dc:date>
    <item>
      <title>Substract values of two columns and display the difference in third column?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Substract-values-of-two-columns-and-display-the-difference-in/m-p/353574#M104653</link>
      <description>&lt;P&gt;I have a table which have fields Rank, City, Population _2001, Population _2011. Now I want to find the growth in population for respective cities. I try fetching the growth with "eval growth=P2011-P2001", but it didn't work. Please suggest some way to achieve this.&lt;/P&gt;

&lt;P&gt;Search Query: index="rashid" City=A* AND "Population _2001"&amp;gt;="100000" | table Rank, City, "Population _2001", "Population _2011" |rename "Population _2001" as P2001|rename "Population _2011" as P2011| eval growth=P2011-P2001&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/4806iF8AA077637FB62D1/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Apr 2018 04:35:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Substract-values-of-two-columns-and-display-the-difference-in/m-p/353574#M104653</guid>
      <dc:creator>rashidjorvee</dc:creator>
      <dc:date>2018-04-24T04:35:28Z</dc:date>
    </item>
    <item>
      <title>Re: Substract values of two columns and display the difference in third column?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Substract-values-of-two-columns-and-display-the-difference-in/m-p/353575#M104654</link>
      <description>&lt;P&gt;I think the problem is the values are seen as strings because of commas,&lt;BR /&gt;
add the following before your eval to convert strings to numbers:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| convert num(P2001) num(P2011)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Apr 2018 13:58:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Substract-values-of-two-columns-and-display-the-difference-in/m-p/353575#M104654</guid>
      <dc:creator>damien_chillet</dc:creator>
      <dc:date>2018-04-24T13:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: Substract values of two columns and display the difference in third column?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Substract-values-of-two-columns-and-display-the-difference-in/m-p/353576#M104655</link>
      <description>&lt;P&gt;Also, worth saying that your filter &amp;gt;= 100000 does not seem to work because Aurangabad is in the results and has 79,393 inhabitants.&lt;BR /&gt;
You will have to create a calculated field to remediate that.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Apr 2018 14:00:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Substract-values-of-two-columns-and-display-the-difference-in/m-p/353576#M104655</guid>
      <dc:creator>damien_chillet</dc:creator>
      <dc:date>2018-04-24T14:00:48Z</dc:date>
    </item>
    <item>
      <title>Re: Substract values of two columns and display the difference in third column?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Substract-values-of-two-columns-and-display-the-difference-in/m-p/353577#M104656</link>
      <description>&lt;P&gt;The reason why the values are not subtracted because of "," in the number make splunk to consider them as string and unable to do the caluclation .&lt;/P&gt;

&lt;P&gt;For this we need to convert the fields to number so that "," will be removed and then eval diff = p1 - p2 &lt;/P&gt;

&lt;P&gt;For example &lt;/P&gt;

&lt;P&gt;|makeresults |eval p1 = "2,000;1,000" |eval p2= "10,00;2,000" | eval  p1 = split(p1,";") |eval p2 = split(p2, ";") |mvexpand p1 |mvexpand p2 |convert num(p*) |eval diff = p1-p2&lt;/P&gt;</description>
      <pubDate>Tue, 24 Apr 2018 14:04:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Substract-values-of-two-columns-and-display-the-difference-in/m-p/353577#M104656</guid>
      <dc:creator>ssadanala1</dc:creator>
      <dc:date>2018-04-24T14:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: Substract values of two columns and display the difference in third column?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Substract-values-of-two-columns-and-display-the-difference-in/m-p/353578#M104657</link>
      <description>&lt;P&gt;Yes, this filter is not working as well.&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2018 14:44:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Substract-values-of-two-columns-and-display-the-difference-in/m-p/353578#M104657</guid>
      <dc:creator>rashidjorvee</dc:creator>
      <dc:date>2018-05-02T14:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: Substract values of two columns and display the difference in third column?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Substract-values-of-two-columns-and-display-the-difference-in/m-p/353579#M104658</link>
      <description>&lt;P&gt;Thank you for your explanation. @ssadanala1&lt;BR /&gt;
When I converted that field in a number those commas [,] has been removed and then my query is working fine and returning expected result.&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2018 14:46:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Substract-values-of-two-columns-and-display-the-difference-in/m-p/353579#M104658</guid>
      <dc:creator>rashidjorvee</dc:creator>
      <dc:date>2018-05-02T14:46:44Z</dc:date>
    </item>
  </channel>
</rss>

