<?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 get the count of a field WITH values and the count of the same field WITHOUT values in the same search using Hunk? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-count-of-a-field-WITH-values-and-the-count-of-the/m-p/275667#M83157</link>
    <description>&lt;P&gt;Couple of options you could try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search | eval zip=if(LOCATION.postalCode="*", 1, 0) | stats count(eval(zip=1)) as wzip count(eval(zip=0)) as nozip 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search | stats count(eval(LOCATION.postalCode="*") as zip count as total | eval nozip=total-zip
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 12 Dec 2015 15:59:27 GMT</pubDate>
    <dc:creator>sundareshr</dc:creator>
    <dc:date>2015-12-12T15:59:27Z</dc:date>
    <item>
      <title>How to get the count of a field WITH values and the count of the same field WITHOUT values in the same search using Hunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-count-of-a-field-WITH-values-and-the-count-of-the/m-p/275662#M83152</link>
      <description>&lt;P&gt;I'm trying to count the number of occurrences of a field WITH values and the number of the same field WITHOUT values in the same search. I can't seem to return any counts for either eval statement. I am using HUNK.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search | eval zip=(if(NOT LOCATION.postalCode="*",1,0)) | stats sum(zip) as count | eval noZip=(if(LOCATION.postalCode="*",1,0)) | stats sum(noZip)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Dec 2015 17:37:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-count-of-a-field-WITH-values-and-the-count-of-the/m-p/275662#M83152</guid>
      <dc:creator>pontorito</dc:creator>
      <dc:date>2015-12-09T17:37:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the count of a field WITH values and the count of the same field WITHOUT values in the same search using Hunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-count-of-a-field-WITH-values-and-the-count-of-the/m-p/275663#M83153</link>
      <description>&lt;P&gt;not sure why but it's not displaying correctly but in my query I do have an * between the quotes in both statements&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2015 17:39:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-count-of-a-field-WITH-values-and-the-count-of-the/m-p/275663#M83153</guid>
      <dc:creator>pontorito</dc:creator>
      <dc:date>2015-12-09T17:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the count of a field WITH values and the count of the same field WITHOUT values in the same search using Hunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-count-of-a-field-WITH-values-and-the-count-of-the/m-p/275664#M83154</link>
      <description>&lt;P&gt;I don't have experience with Hunk, but using just core Splunk would something like this work? &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search | stats count(LOCATION.postalCode) as countWith count(eval(isnull(LOCATION.postalCode))) as countWithout 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Alternatively if you need to use your evals and sums, if you move both evals to before the stats you could do both sums in one stats&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search | eval zip=... | eval noZip=... | stats sum(zip) as count sum(noZip)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Dec 2015 17:43:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-count-of-a-field-WITH-values-and-the-count-of-the/m-p/275664#M83154</guid>
      <dc:creator>acharlieh</dc:creator>
      <dc:date>2015-12-09T17:43:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the count of a field WITH values and the count of the same field WITHOUT values in the same search using Hunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-count-of-a-field-WITH-values-and-the-count-of-the/m-p/275665#M83155</link>
      <description>&lt;P&gt;Answers uses markdown for formatting, so without indenting 4 spaces it was intrepreting the &lt;CODE&gt;*&lt;/CODE&gt; as markers for italics. but if you indent 4 spaces, it becomes a code block... &lt;A href="https://daringfireball.net/projects/markdown/syntax"&gt;https://daringfireball.net/projects/markdown/syntax&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2015 17:45:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-count-of-a-field-WITH-values-and-the-count-of-the/m-p/275665#M83155</guid>
      <dc:creator>acharlieh</dc:creator>
      <dc:date>2015-12-09T17:45:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the count of a field WITH values and the count of the same field WITHOUT values in the same search using Hunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-count-of-a-field-WITH-values-and-the-count-of-the/m-p/275666#M83156</link>
      <description>&lt;P&gt;This is close..except the &lt;BR /&gt;
    count(eval(isnull(LOCATION.postalCode)))&lt;/P&gt;

&lt;P&gt;statement still brings in records with the LOCATION.postalCode field. How can I incorporate a WHERE isnull(LOCATION.postalCode) into the eval?&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2015 15:00:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-count-of-a-field-WITH-values-and-the-count-of-the/m-p/275666#M83156</guid>
      <dc:creator>pontorito</dc:creator>
      <dc:date>2015-12-10T15:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the count of a field WITH values and the count of the same field WITHOUT values in the same search using Hunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-count-of-a-field-WITH-values-and-the-count-of-the/m-p/275667#M83157</link>
      <description>&lt;P&gt;Couple of options you could try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search | eval zip=if(LOCATION.postalCode="*", 1, 0) | stats count(eval(zip=1)) as wzip count(eval(zip=0)) as nozip 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search | stats count(eval(LOCATION.postalCode="*") as zip count as total | eval nozip=total-zip
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 12 Dec 2015 15:59:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-count-of-a-field-WITH-values-and-the-count-of-the/m-p/275667#M83157</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2015-12-12T15:59:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the count of a field WITH values and the count of the same field WITHOUT values in the same search using Hunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-count-of-a-field-WITH-values-and-the-count-of-the/m-p/275668#M83158</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search | stats count AS total, count(eval(isnull(LOCATION.postalCode))) AS noZip | eval Zip = count - noZip
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 13 Dec 2015 03:14:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-count-of-a-field-WITH-values-and-the-count-of-the/m-p/275668#M83158</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-12-13T03:14:21Z</dc:date>
    </item>
  </channel>
</rss>

