<?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 Add a column that is the difference of the first two columns. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Add-a-column-that-is-the-difference-of-the-first-two-columns/m-p/510488#M142875</link>
    <description>&lt;P&gt;So suppose that everyday Splunk takes in a report that houses 9 different fields, one of which is called 'status'. Status has the option of being 'New', 'Closed', or 'Open'. I'm trying to show a time-chart that shows the count per day of reports that have 'Closed' and 'New' status , along with the difference of the two (everyday). So a file with report_date '2020-07-23' is ingested in Splunk and shows we had 5 'New' reports, 7 'Closed' Reports, so the difference should be 2 for that day. How do I go about doing this in my search query?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=blah... | timechart count(report_date) by status| fields - OPEN&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is where I'm stuck, how do I get the difference of only NEW and CLOSED included into my graph. Thanks in advance&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jul 2020 16:11:28 GMT</pubDate>
    <dc:creator>Username1</dc:creator>
    <dc:date>2020-07-22T16:11:28Z</dc:date>
    <item>
      <title>Add a column that is the difference of the first two columns.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-a-column-that-is-the-difference-of-the-first-two-columns/m-p/510488#M142875</link>
      <description>&lt;P&gt;So suppose that everyday Splunk takes in a report that houses 9 different fields, one of which is called 'status'. Status has the option of being 'New', 'Closed', or 'Open'. I'm trying to show a time-chart that shows the count per day of reports that have 'Closed' and 'New' status , along with the difference of the two (everyday). So a file with report_date '2020-07-23' is ingested in Splunk and shows we had 5 'New' reports, 7 'Closed' Reports, so the difference should be 2 for that day. How do I go about doing this in my search query?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=blah... | timechart count(report_date) by status| fields - OPEN&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is where I'm stuck, how do I get the difference of only NEW and CLOSED included into my graph. Thanks in advance&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 16:11:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-a-column-that-is-the-difference-of-the-first-two-columns/m-p/510488#M142875</guid>
      <dc:creator>Username1</dc:creator>
      <dc:date>2020-07-22T16:11:28Z</dc:date>
    </item>
    <item>
      <title>Re: Add a column that is the difference of the first two columns.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-a-column-that-is-the-difference-of-the-first-two-columns/m-p/510501#M142877</link>
      <description>&lt;P&gt;This should do it.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=blah... | timechart count(report_date) by status
| fields - OPEN
| eval diff=abs(New - Closed)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 22 Jul 2020 17:35:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-a-column-that-is-the-difference-of-the-first-two-columns/m-p/510501#M142877</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-07-22T17:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: Add a column that is the difference of the first two columns.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-a-column-that-is-the-difference-of-the-first-two-columns/m-p/510502#M142878</link>
      <description>&lt;P&gt;That worked perfectly. Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 17:40:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-a-column-that-is-the-difference-of-the-first-two-columns/m-p/510502#M142878</guid>
      <dc:creator>Username1</dc:creator>
      <dc:date>2020-07-22T17:40:02Z</dc:date>
    </item>
  </channel>
</rss>

