<?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 Filtering out NULL values after stats not working in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Filtering-out-NULL-values-after-stats-not-working/m-p/571530#M199156</link>
    <description>&lt;P&gt;I am trying to filter out null values from the result of stats. Query looks like below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=someindex* some
   ((somefield1=value1 AND somefield2="value2") 
     AND (somefield1=value3  
          OR (somefield2=value4  
               AND somefield1=value5
              )
         )
   )
   OR (somefield1=value6)
| eval someeval=...
| replace "some*" with "SOME" in somefield1
| bucket _time span=1d as daytime
| stats max(eval(if(somefield1=value1,_time,null()))) as val1_time
        min(eval(if(somefield1=value2,_time,null()))) as val2_time
        min(eval(if(somefield1=value3 ,_time,null()))) as val3_time
        by somefield3 somefield4 
| eval recovered_time=if(isNotNull(val2_time),val2_time,val3_time)
| where isNotNull(val1_time)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this query returns result with null or empty val1_time also.&lt;BR /&gt;&lt;BR /&gt;What could be the issue in this query? I further pass the result of this query to another stats query.&amp;nbsp; But I am stuck here.&lt;/P&gt;</description>
    <pubDate>Tue, 19 Oct 2021 15:56:17 GMT</pubDate>
    <dc:creator>tumapath</dc:creator>
    <dc:date>2021-10-19T15:56:17Z</dc:date>
    <item>
      <title>Filtering out NULL values after stats not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filtering-out-NULL-values-after-stats-not-working/m-p/571530#M199156</link>
      <description>&lt;P&gt;I am trying to filter out null values from the result of stats. Query looks like below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=someindex* some
   ((somefield1=value1 AND somefield2="value2") 
     AND (somefield1=value3  
          OR (somefield2=value4  
               AND somefield1=value5
              )
         )
   )
   OR (somefield1=value6)
| eval someeval=...
| replace "some*" with "SOME" in somefield1
| bucket _time span=1d as daytime
| stats max(eval(if(somefield1=value1,_time,null()))) as val1_time
        min(eval(if(somefield1=value2,_time,null()))) as val2_time
        min(eval(if(somefield1=value3 ,_time,null()))) as val3_time
        by somefield3 somefield4 
| eval recovered_time=if(isNotNull(val2_time),val2_time,val3_time)
| where isNotNull(val1_time)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this query returns result with null or empty val1_time also.&lt;BR /&gt;&lt;BR /&gt;What could be the issue in this query? I further pass the result of this query to another stats query.&amp;nbsp; But I am stuck here.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Oct 2021 15:56:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filtering-out-NULL-values-after-stats-not-working/m-p/571530#M199156</guid>
      <dc:creator>tumapath</dc:creator>
      <dc:date>2021-10-19T15:56:17Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering out NULL values after stats not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filtering-out-NULL-values-after-stats-not-working/m-p/571755#M199239</link>
      <description>&lt;P&gt;Adding this line in the end does the magic.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| where isNotNull(val1_time) AND val1_time != ""&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Oct 2021 04:17:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filtering-out-NULL-values-after-stats-not-working/m-p/571755#M199239</guid>
      <dc:creator>tumapath</dc:creator>
      <dc:date>2021-10-21T04:17:07Z</dc:date>
    </item>
  </channel>
</rss>

