<?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: Stats Count Eval If in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Stats-Count-Eval-If/m-p/407280#M117627</link>
    <description>&lt;P&gt;What's the current output (with original query) and what's the expected output?&lt;/P&gt;</description>
    <pubDate>Mon, 25 Feb 2019 20:01:46 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2019-02-25T20:01:46Z</dc:date>
    <item>
      <title>Stats Count Eval If</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-Count-Eval-If/m-p/407275#M117622</link>
      <description>&lt;P&gt;Hi, I wonder whether someone can help me please.&lt;/P&gt;

&lt;P&gt;I'm using number the following as part of a query to extract data from a summary Index&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats  count(eval(repayments_submit="1")) as repyaments_submit count(eval(forms_ChB="1")) as forms_ChB
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The code works find, except that where the null value is null, it's shown as a zero and I'd like it to be blank.&lt;/P&gt;

&lt;P&gt;I've tried &lt;CODE&gt;count(eval(if(signout="1", "")))&lt;/CODE&gt;,  but I receive the following error: &lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;Error in 'stats' command: The eval&lt;BR /&gt;
expression for dynamic field&lt;BR /&gt;
'eval(if(signout="1", ""))' is&lt;BR /&gt;
invalid. Error='The arguments to the&lt;BR /&gt;
'if' function are invalid.'&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Could someone look at this please and let me know where I've gone wrong?&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2019 10:52:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-Count-Eval-If/m-p/407275#M117622</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2019-02-25T10:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: Stats Count Eval If</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-Count-Eval-If/m-p/407276#M117623</link>
      <description>&lt;P&gt;@IRHM73,&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;if&lt;/CODE&gt; command expects three parameters - condition, "value when match", "value when no match"&lt;/P&gt;

&lt;P&gt;so in your case , you need to add &lt;CODE&gt;count(eval(if(signout="1", "","&amp;lt;value if signout doesnt match&amp;gt;")))&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2019 13:33:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-Count-Eval-If/m-p/407276#M117623</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2019-02-25T13:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: Stats Count Eval If</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-Count-Eval-If/m-p/407277#M117624</link>
      <description>&lt;P&gt;Hi @renjith.nair.&lt;/P&gt;

&lt;P&gt;Thank you for coming back to me with this.&lt;/P&gt;

&lt;P&gt;Unfortunately I'd like the field to be blank if it zero rather than having a value in it. When I have tried the code you kindly provided, even putting a text value in, the field still returns a zero.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2019 15:23:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-Count-Eval-If/m-p/407277#M117624</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2019-02-25T15:23:51Z</dc:date>
    </item>
    <item>
      <title>Re: Stats Count Eval If</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-Count-Eval-If/m-p/407278#M117625</link>
      <description>&lt;P&gt;Would a "-" be acceptable? &lt;BR /&gt;
"-","")))&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2019 17:44:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-Count-Eval-If/m-p/407278#M117625</guid>
      <dc:creator>noy72</dc:creator>
      <dc:date>2019-02-25T17:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: Stats Count Eval If</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-Count-Eval-If/m-p/407279#M117626</link>
      <description>&lt;P&gt;One correction in "if" function is already mentioned by renjith. &lt;/P&gt;

&lt;P&gt;Regarding returning a blank value: When you use count, it will always return an integer, you may have to use another eval to set the field to blank if it is "0".&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2019 19:59:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-Count-Eval-If/m-p/407279#M117626</guid>
      <dc:creator>cvssravan</dc:creator>
      <dc:date>2019-02-25T19:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: Stats Count Eval If</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-Count-Eval-If/m-p/407280#M117627</link>
      <description>&lt;P&gt;What's the current output (with original query) and what's the expected output?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2019 20:01:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-Count-Eval-If/m-p/407280#M117627</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2019-02-25T20:01:46Z</dc:date>
    </item>
    <item>
      <title>Re: Stats Count Eval If</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-Count-Eval-If/m-p/407281#M117628</link>
      <description>&lt;P&gt;Hi @somesoni2. Thank you for coming back to me with this.&lt;/P&gt;

&lt;P&gt;The current output is a zero, but I'd like the value to be blank please.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Tue, 26 Feb 2019 06:58:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-Count-Eval-If/m-p/407281#M117628</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2019-02-26T06:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: Stats Count Eval If</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-Count-Eval-If/m-p/407282#M117629</link>
      <description>&lt;P&gt;Hi @noy72 . Thank you for coming back to me. This is something that I may have to think about. Although not ideal, it would at least have a greater difference visually from a number.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Tue, 26 Feb 2019 07:09:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-Count-Eval-If/m-p/407282#M117629</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2019-02-26T07:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: Stats Count Eval If</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-Count-Eval-If/m-p/407283#M117630</link>
      <description>&lt;P&gt;Hi @cvssravan.&lt;/P&gt;

&lt;P&gt;Thank you for this. I'll have to look to see if this is possible.&lt;/P&gt;

&lt;P&gt;Kind Regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Tue, 26 Feb 2019 07:24:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-Count-Eval-If/m-p/407283#M117630</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2019-02-26T07:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: Stats Count Eval If</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-Count-Eval-If/m-p/407284#M117631</link>
      <description>&lt;P&gt;Hi, I found the solution which is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sum(eval(if(signout="1", "1", "")))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Many thanks to all your suggestions and help.&lt;/P&gt;

&lt;P&gt;Kind Regards&lt;/P&gt;</description>
      <pubDate>Tue, 26 Feb 2019 08:09:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-Count-Eval-If/m-p/407284#M117631</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2019-02-26T08:09:28Z</dc:date>
    </item>
  </channel>
</rss>

