<?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 How to get percentage of null vs not-null values grouped by each day? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-percentage-of-null-vs-not-null-values-grouped-by-each/m-p/485579#M135853</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I've written a query to get percentage of null vs not-null values of a particular field (i.e. billValue). However, it gives me a complete result for the entire month or week (depending on the time-period selected). How do I get the result grouped by each day (or each hour etc). I tried a lot of different things from Google like 'eventstats', 'bin &lt;EM&gt;time span=1d', 'bucket _time span=day, 'timechart'' etc., but the problem is that none of them work when I use by _time after count. I believe it may be due to the use of _count(eval(isnull(fieldName)))&lt;/EM&gt; in my query, but not sure. Please see below query which correctly gives me the percentage for complete month (whereas I need day by day):&lt;/P&gt;

&lt;P&gt;[Base Query] | extract pairdelim="{,}" kvdelim=":"| table billValue| stats count(eval(isnotnull(billValue))) AS notNullBill, count(eval(isnull(billValue))) AS nullBill| eval Percentage=Round(((nullBill/notNullBill)*100),2) | table Percentage&lt;/P&gt;

&lt;P&gt;I'm new to Splunk. Any help is greatly appreciated.&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Fri, 15 Nov 2019 08:59:29 GMT</pubDate>
    <dc:creator>pratik0807ray</dc:creator>
    <dc:date>2019-11-15T08:59:29Z</dc:date>
    <item>
      <title>How to get percentage of null vs not-null values grouped by each day?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-percentage-of-null-vs-not-null-values-grouped-by-each/m-p/485579#M135853</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I've written a query to get percentage of null vs not-null values of a particular field (i.e. billValue). However, it gives me a complete result for the entire month or week (depending on the time-period selected). How do I get the result grouped by each day (or each hour etc). I tried a lot of different things from Google like 'eventstats', 'bin &lt;EM&gt;time span=1d', 'bucket _time span=day, 'timechart'' etc., but the problem is that none of them work when I use by _time after count. I believe it may be due to the use of _count(eval(isnull(fieldName)))&lt;/EM&gt; in my query, but not sure. Please see below query which correctly gives me the percentage for complete month (whereas I need day by day):&lt;/P&gt;

&lt;P&gt;[Base Query] | extract pairdelim="{,}" kvdelim=":"| table billValue| stats count(eval(isnotnull(billValue))) AS notNullBill, count(eval(isnull(billValue))) AS nullBill| eval Percentage=Round(((nullBill/notNullBill)*100),2) | table Percentage&lt;/P&gt;

&lt;P&gt;I'm new to Splunk. Any help is greatly appreciated.&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2019 08:59:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-percentage-of-null-vs-not-null-values-grouped-by-each/m-p/485579#M135853</guid>
      <dc:creator>pratik0807ray</dc:creator>
      <dc:date>2019-11-15T08:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to get percentage of null vs not-null values grouped by each day?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-percentage-of-null-vs-not-null-values-grouped-by-each/m-p/485580#M135854</link>
      <description>&lt;P&gt;@pratik0807ray ,&lt;/P&gt;

&lt;P&gt;You are filtering the fields by using &lt;CODE&gt;table billValue&lt;/CODE&gt; and hence _time is not available for further processing.&lt;/P&gt;

&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[Base Query] | extract pairdelim="{,}" kvdelim=":"|bucket span=1d _time|stats count(eval(isnotnull(billValue))) AS notNullBill, count(eval(isnull(billValue))) AS nullBill by _time| eval Percentage=Round(((nullBill/notNullBill)*100),2)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Nov 2019 09:51:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-percentage-of-null-vs-not-null-values-grouped-by-each/m-p/485580#M135854</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2019-11-15T09:51:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to get percentage of null vs not-null values grouped by each day?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-percentage-of-null-vs-not-null-values-grouped-by-each/m-p/485581#M135855</link>
      <description>&lt;P&gt;Hi Renjith,&lt;/P&gt;

&lt;P&gt;Thanks for the help, but '&lt;EM&gt;eval Percentage=Round(((nullBill/notNullBill)*100),2) by _time&lt;/EM&gt;' is giving me below error:&lt;/P&gt;

&lt;P&gt;Error in 'eval' command: The expression is malformed.&lt;/P&gt;

&lt;P&gt;If I use only '&lt;EM&gt;eval Percentage=Round(((nullBill/notNullBill)*100),2)&lt;/EM&gt;', there's no error, but as expected it's not grouped by days.&lt;/P&gt;

&lt;P&gt;Feel like there's some minor syntax issue here. Any further suggestion you can give me?&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:59:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-percentage-of-null-vs-not-null-values-grouped-by-each/m-p/485581#M135855</guid>
      <dc:creator>pratik0807ray</dc:creator>
      <dc:date>2020-09-30T02:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to get percentage of null vs not-null values grouped by each day?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-percentage-of-null-vs-not-null-values-grouped-by-each/m-p/485582#M135856</link>
      <description>&lt;P&gt;My bad, somehow misplaced by clause. Updated the answer. &lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2019 11:14:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-percentage-of-null-vs-not-null-values-grouped-by-each/m-p/485582#M135856</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2019-11-15T11:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to get percentage of null vs not-null values grouped by each day?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-percentage-of-null-vs-not-null-values-grouped-by-each/m-p/485583#M135857</link>
      <description>&lt;P&gt;Thanks so much Rejith. It's working great. Accepting your answer... Thanks again! &lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2019 11:17:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-percentage-of-null-vs-not-null-values-grouped-by-each/m-p/485583#M135857</guid>
      <dc:creator>pratik0807ray</dc:creator>
      <dc:date>2019-11-15T11:17:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to get percentage of null vs not-null values grouped by each day?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-percentage-of-null-vs-not-null-values-grouped-by-each/m-p/485584#M135858</link>
      <description>&lt;P&gt;This would be more efficient like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[Base Query]
| extract pairdelim="{,}" kvdelim=":"
| timechart span=1d count(billValue) AS notNullBill, count AS total
| eval nullBill = total - notNullBill
| eval Percentage=round(((nullBill / notNullBill) * 100), 2)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Nov 2019 16:32:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-percentage-of-null-vs-not-null-values-grouped-by-each/m-p/485584#M135858</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-11-15T16:32:43Z</dc:date>
    </item>
  </channel>
</rss>

