<?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: I Need Help Filling Null Fields with Zero in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/I-Need-Help-Filling-Null-Fields-with-Zero/m-p/212190#M62076</link>
    <description>&lt;P&gt;Try this (very hackish but will work):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=vertex7-access RTG_Error="500" earliest=-26h@h latest=-25h@h | append [| noop | stats count AS RTG_Tax | eval RTG_Tax = "LookupTax"] | stats count AS YesterdayLastHour by RTG_Tax | eval YesterdayLastHour = YesterdayLastHour - if((RTG_Tax = "LookupTax"), 1, 0) | addtotals col=t row=f labelfield=RTG_Tax label=Total | table RTG_Tax, YesterdayLastHour | rename RTG_Tax AS Total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It works by artificially inflating "LookupTax" by 1 to ensure that it exists and then decreasing it by 1 once the row/event is established.&lt;/P&gt;</description>
    <pubDate>Wed, 02 Sep 2015 15:47:20 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2015-09-02T15:47:20Z</dc:date>
    <item>
      <title>I Need Help Filling Null Fields with Zero</title>
      <link>https://community.splunk.com/t5/Splunk-Search/I-Need-Help-Filling-Null-Fields-with-Zero/m-p/212186#M62072</link>
      <description>&lt;P&gt;I have 2 tax calls (CalculateTax and LookupTax) and want to count their errors for the previous day's hour. I then added a row which would sum the totals up. So My table looks like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Tax Call     |   YesterdayLastHour 
CalculateTax |        70
Total        |        70
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But I want it to look like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Tax Call     |   YesterdayLastHour 
CalculateTax |        70
LookupTax    |         0
Total        |        70
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Currently, if there are values for both CalculateTax and LookupTax then it will display correctly like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    Tax Call     |   YesterdayLastHour 
    CalculateTax |        70
    LookupTax    |        10
    Total        |        80
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here's my search &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=vertex7-access RTG_Error="500" earliest=-26h@h latest=-25h@h 
| stats count AS YesterdayLastHour by RTG_Tax 
| addtotals col=t row=f labelfield=RTG_Tax label=Total 
| table RTG_Tax, YesterdayLastHour | rename RTG_Tax AS Total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So the problem I'm facing is, if there is a zero count for a LookupTax call, then the tax call will not display. I want the LookupTax call to display, but show a 0 for the count&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2015 14:31:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/I-Need-Help-Filling-Null-Fields-with-Zero/m-p/212186#M62072</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2015-09-02T14:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: I Need Help Filling Null Fields with Zero</title>
      <link>https://community.splunk.com/t5/Splunk-Search/I-Need-Help-Filling-Null-Fields-with-Zero/m-p/212187#M62073</link>
      <description>&lt;P&gt;index=vertex7-access RTG_Error="500" earliest=-26h@h latest=-25h@h &lt;BR /&gt;
 | fillnull value=0 LookupTax&lt;BR /&gt;
 | stats count AS YesterdayLastHour by RTG_Tax &lt;BR /&gt;
 | addtotals col=t row=f labelfield=RTG_Tax label=Total &lt;BR /&gt;
 | table RTG_Tax, YesterdayLastHour | rename RTG_Tax AS Total&lt;/P&gt;

&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:13:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/I-Need-Help-Filling-Null-Fields-with-Zero/m-p/212187#M62073</guid>
      <dc:creator>thirumalreddyb</dc:creator>
      <dc:date>2020-09-29T07:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: I Need Help Filling Null Fields with Zero</title>
      <link>https://community.splunk.com/t5/Splunk-Search/I-Need-Help-Filling-Null-Fields-with-Zero/m-p/212188#M62074</link>
      <description>&lt;P&gt;I tried that with no luck already &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I'm thinking that I have to hardcode in CalculateTax and Lookuptax rather than calling RTG_Tax so it's forced to pick it up..&lt;/P&gt;

&lt;P&gt;The field 'Lookuptax' doesn't even show up if there's no value for YesterdayLastHour&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2015 14:45:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/I-Need-Help-Filling-Null-Fields-with-Zero/m-p/212188#M62074</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2015-09-02T14:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: I Need Help Filling Null Fields with Zero</title>
      <link>https://community.splunk.com/t5/Splunk-Search/I-Need-Help-Filling-Null-Fields-with-Zero/m-p/212189#M62075</link>
      <description>&lt;P&gt;Try something like this (assuming that you have "CalculateTax" and "LookupTax" hardcoded values for RTG_Tax)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;     index=vertex7-access RTG_Error="500" earliest=-26h@h latest=-25h@h 
     | stats count AS YesterdayLastHour by RTG_Tax 
 | append [| gentimes start=-1 | eval RTG_Tax="CalculateTax LookupTax" | table RTG_Tax makemv RTG_Tax | mvexpand RTG_Tax | eval YesterdayLastHour=0] | stats max(YesterdayLastHour) as YesterdayLastHour by RTG_Tax
     | addtotals col=t row=f labelfield=RTG_Tax label=Total 
     | table RTG_Tax, YesterdayLastHour | rename RTG_Tax AS Total
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Sep 2015 15:36:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/I-Need-Help-Filling-Null-Fields-with-Zero/m-p/212189#M62075</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-09-02T15:36:39Z</dc:date>
    </item>
    <item>
      <title>Re: I Need Help Filling Null Fields with Zero</title>
      <link>https://community.splunk.com/t5/Splunk-Search/I-Need-Help-Filling-Null-Fields-with-Zero/m-p/212190#M62076</link>
      <description>&lt;P&gt;Try this (very hackish but will work):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=vertex7-access RTG_Error="500" earliest=-26h@h latest=-25h@h | append [| noop | stats count AS RTG_Tax | eval RTG_Tax = "LookupTax"] | stats count AS YesterdayLastHour by RTG_Tax | eval YesterdayLastHour = YesterdayLastHour - if((RTG_Tax = "LookupTax"), 1, 0) | addtotals col=t row=f labelfield=RTG_Tax label=Total | table RTG_Tax, YesterdayLastHour | rename RTG_Tax AS Total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It works by artificially inflating "LookupTax" by 1 to ensure that it exists and then decreasing it by 1 once the row/event is established.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2015 15:47:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/I-Need-Help-Filling-Null-Fields-with-Zero/m-p/212190#M62076</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-09-02T15:47:20Z</dc:date>
    </item>
    <item>
      <title>Re: I Need Help Filling Null Fields with Zero</title>
      <link>https://community.splunk.com/t5/Splunk-Search/I-Need-Help-Filling-Null-Fields-with-Zero/m-p/212191#M62077</link>
      <description>&lt;P&gt;Thanks for help &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/15147"&gt;@somesoni2&lt;/a&gt;&lt;/P&gt;

&lt;P&gt;This solution partially worked.. Unfortunately I did not hard code CalculateTax and LookupTax for RTG_Tax.. I did a field extraction for RTG_Tax and wrote a regular expression which would pick up CalculateTax and LookupTax. When I tried your solution, it is indeed working if LookupTax has a value of 0. But when I modify the time where we had values for both Lookup and Calculate, then there is an additional row which is showing 0.. Is there a way we can write an IF statement saying &lt;CODE&gt;IF both calculatetax and lookuptax have values, THEN ignore the hard coded value&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Here's what it looks like if CalculateTax and LookupTax have values&amp;gt;0&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    Tax Call       |   YesterdayLastHour
    CalculateTax   |    54 
    LookupTax      |     0 
    LookupTax      |     2
    TOTAL          |    56
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:13:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/I-Need-Help-Filling-Null-Fields-with-Zero/m-p/212191#M62077</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2020-09-29T07:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: I Need Help Filling Null Fields with Zero</title>
      <link>https://community.splunk.com/t5/Splunk-Search/I-Need-Help-Filling-Null-Fields-with-Zero/m-p/212192#M62078</link>
      <description>&lt;P&gt;I had an error on my end.. Testing it now, so far it's working correctly. Will post back with final results soon. Thanks for the help!!!&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2015 17:30:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/I-Need-Help-Filling-Null-Fields-with-Zero/m-p/212192#M62078</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2015-09-02T17:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: I Need Help Filling Null Fields with Zero</title>
      <link>https://community.splunk.com/t5/Splunk-Search/I-Need-Help-Filling-Null-Fields-with-Zero/m-p/212193#M62079</link>
      <description>&lt;P&gt;Note that I only addressed the possibility of &lt;CODE&gt;LookupTax&lt;/CODE&gt; being 0 so if other fields may be 0 also, the same approach can be used for them.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2015 18:15:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/I-Need-Help-Filling-Null-Fields-with-Zero/m-p/212193#M62079</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-09-02T18:15:06Z</dc:date>
    </item>
    <item>
      <title>Re: I Need Help Filling Null Fields with Zero</title>
      <link>https://community.splunk.com/t5/Splunk-Search/I-Need-Help-Filling-Null-Fields-with-Zero/m-p/212194#M62080</link>
      <description>&lt;P&gt;You're pretty good at reading my mind.. I just got done fixing that &lt;/P&gt;

&lt;P&gt;This search was only a piece of a larger search I had to integrate it with aswell. I just got done cleaning everything up and now I'm testing it. It looks good so far, just need to go over a few test cases still&lt;/P&gt;

&lt;P&gt;P.S. Can you explain what &lt;CODE&gt;noop&lt;/CODE&gt; does?&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2015 18:19:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/I-Need-Help-Filling-Null-Fields-with-Zero/m-p/212194#M62080</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2015-09-02T18:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: I Need Help Filling Null Fields with Zero</title>
      <link>https://community.splunk.com/t5/Splunk-Search/I-Need-Help-Filling-Null-Fields-with-Zero/m-p/212195#M62081</link>
      <description>&lt;P&gt;It does nothing ("NO OPeration"); it is the most minimalist way to generate a single event by piping to &lt;CODE&gt;stats count&lt;/CODE&gt; which will always return &lt;CODE&gt;0&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2015 18:38:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/I-Need-Help-Filling-Null-Fields-with-Zero/m-p/212195#M62081</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-09-02T18:38:26Z</dc:date>
    </item>
    <item>
      <title>Re: I Need Help Filling Null Fields with Zero</title>
      <link>https://community.splunk.com/t5/Splunk-Search/I-Need-Help-Filling-Null-Fields-with-Zero/m-p/212196#M62082</link>
      <description>&lt;P&gt;This search works perfectly!! Thanks for your help, I appreciate it&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2015 18:42:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/I-Need-Help-Filling-Null-Fields-with-Zero/m-p/212196#M62082</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2015-09-02T18:42:30Z</dc:date>
    </item>
  </channel>
</rss>

