<?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: Fill in 0 for timechart with missing values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Fill-in-0-for-timechart-with-missing-values/m-p/111958#M29385</link>
    <description>&lt;P&gt;Couldn't you rename your timecharted count value, then use an eval and if to replace null values with 0?&lt;/P&gt;

&lt;P&gt;| timechart span=1d count as val | eval val = if(isnull(val),0,val)&lt;/P&gt;</description>
    <pubDate>Thu, 10 Aug 2017 08:30:03 GMT</pubDate>
    <dc:creator>gf13579</dc:creator>
    <dc:date>2017-08-10T08:30:03Z</dc:date>
    <item>
      <title>Fill in 0 for timechart with missing values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fill-in-0-for-timechart-with-missing-values/m-p/111955#M29382</link>
      <description>&lt;P&gt;I'm generating a chart with event count by date.  The problem is for dates with no events, the chart is empty.  I want it to display 0 for those dates and setting "treat null as zero" OR connect does not work.  I wind up with only counts for the dates that have counts.&lt;/P&gt;

&lt;P&gt;How to workaround?&lt;/P&gt;

&lt;P&gt;Query:&lt;/P&gt;

&lt;P&gt;index=main startdaysago=10 | timechart span=1d count&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2014 05:28:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fill-in-0-for-timechart-with-missing-values/m-p/111955#M29382</guid>
      <dc:creator>the_wolverine</dc:creator>
      <dc:date>2014-01-14T05:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: Fill in 0 for timechart with missing values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fill-in-0-for-timechart-with-missing-values/m-p/111956#M29383</link>
      <description>&lt;P&gt;Create dummy data and append it.  This will fill in the count of 0 of days missing events to count:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main startdaysago=10 | append [| search index=_internal earliest=-30d | head 1000 | fields - * | fields - _* | streamstats count | bucket _time span=1d | eval count=0] | timechart span=1d count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Jan 2014 05:29:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fill-in-0-for-timechart-with-missing-values/m-p/111956#M29383</guid>
      <dc:creator>the_wolverine</dc:creator>
      <dc:date>2014-01-14T05:29:56Z</dc:date>
    </item>
    <item>
      <title>Re: Fill in 0 for timechart with missing values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fill-in-0-for-timechart-with-missing-values/m-p/111957#M29384</link>
      <description>&lt;P&gt;If you think outside the box a little you could use the panel display feature in the dashboard to just show a different/dummy display when there are no results returned.&lt;/P&gt;

&lt;P&gt;For instance I have some single value metrics on a dashboard that normally show N/A if there are no results returned and it also makes the overall panel look a bit untidy.&lt;/P&gt;

&lt;P&gt;So I did this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;     &amp;lt;single depends="$result1$"&amp;gt;
        &amp;lt;title&amp;gt;'Share' Tracking&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| inputlookup user_usage.csv  | search "click on \\\"SHARE\\\"" (name="Toll_DPM_BT_PADATA_DETAILEDUSERACTIONS_AllEnv") (application="*")  NOT (GomezAgent) UserName!="*tollgroup.com" | timechart count span=7d&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-30d@d&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
          &amp;lt;progress&amp;gt;
            &amp;lt;condition match="'job.resultCount' &amp;lt; 1"&amp;gt;
              &amp;lt;set token="fill1"&amp;gt;true&amp;lt;/set&amp;gt;
              &amp;lt;unset token="result1"&amp;gt;&amp;lt;/unset&amp;gt;
            &amp;lt;/condition&amp;gt;
            &amp;lt;condition&amp;gt;
              &amp;lt;set token="result1"&amp;gt;&amp;lt;/set&amp;gt;
              &amp;lt;unset token="fill1"&amp;gt;true&amp;lt;/unset&amp;gt;
            &amp;lt;/condition&amp;gt;
          &amp;lt;/progress&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;all&amp;lt;/option&amp;gt;
        &amp;lt;option name="colorBy"&amp;gt;value&amp;lt;/option&amp;gt;
        &amp;lt;option name="colorMode"&amp;gt;block&amp;lt;/option&amp;gt;
        &amp;lt;option name="numberPrecision"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="rangeColors"&amp;gt;["0x65a637","0x65a637"]&amp;lt;/option&amp;gt;
        &amp;lt;option name="rangeValues"&amp;gt;[1]&amp;lt;/option&amp;gt;
        &amp;lt;option name="showSparkline"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="showTrendIndicator"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="trendColorInterpretation"&amp;gt;standard&amp;lt;/option&amp;gt;
        &amp;lt;option name="trendDisplayMode"&amp;gt;absolute&amp;lt;/option&amp;gt;
        &amp;lt;option name="unitPosition"&amp;gt;after&amp;lt;/option&amp;gt;
        &amp;lt;option name="useColors"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="useThousandSeparators"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="link.visible"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="underLabel"&amp;gt;Compared to Previous Week&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.time.visible"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;drilldown&amp;gt;
          &amp;lt;set token="detail-track"&amp;gt;true&amp;lt;/set&amp;gt;
        &amp;lt;/drilldown&amp;gt;
      &amp;lt;/single&amp;gt;
      &amp;lt;single depends="$fill1$"&amp;gt;
        &amp;lt;title&amp;gt;'Share' Tracking&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| inputlookup fillnull.csv  | timechart count span=7d&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-30d@d&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="colorBy"&amp;gt;trend&amp;lt;/option&amp;gt;
        &amp;lt;option name="colorMode"&amp;gt;block&amp;lt;/option&amp;gt;
        &amp;lt;option name="numberPrecision"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="rangeColors"&amp;gt;["0x65a637","0x65a637"]&amp;lt;/option&amp;gt;
        &amp;lt;option name="rangeValues"&amp;gt;[1]&amp;lt;/option&amp;gt;
        &amp;lt;option name="showSparkline"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="showTrendIndicator"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="trendColorInterpretation"&amp;gt;standard&amp;lt;/option&amp;gt;
        &amp;lt;option name="trendDisplayMode"&amp;gt;absolute&amp;lt;/option&amp;gt;
        &amp;lt;option name="unitPosition"&amp;gt;after&amp;lt;/option&amp;gt;
        &amp;lt;option name="useColors"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="useThousandSeparators"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="link.visible"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="underLabel"&amp;gt;Compared to Previous Week&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.time.visible"&amp;gt;false&amp;lt;/option&amp;gt;
      &amp;lt;/single&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The top box shows if there is a result returned and the bottom one shows a dummy result containing zeros if there is  no results returned.&lt;/P&gt;

&lt;P&gt;The lookup table fillnull.csv would just be something like this&lt;/P&gt;

&lt;P&gt;_time count&lt;BR /&gt;
date 0&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2016 03:43:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fill-in-0-for-timechart-with-missing-values/m-p/111957#M29384</guid>
      <dc:creator>proylea</dc:creator>
      <dc:date>2016-10-21T03:43:55Z</dc:date>
    </item>
    <item>
      <title>Re: Fill in 0 for timechart with missing values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fill-in-0-for-timechart-with-missing-values/m-p/111958#M29385</link>
      <description>&lt;P&gt;Couldn't you rename your timecharted count value, then use an eval and if to replace null values with 0?&lt;/P&gt;

&lt;P&gt;| timechart span=1d count as val | eval val = if(isnull(val),0,val)&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 08:30:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fill-in-0-for-timechart-with-missing-values/m-p/111958#M29385</guid>
      <dc:creator>gf13579</dc:creator>
      <dc:date>2017-08-10T08:30:03Z</dc:date>
    </item>
    <item>
      <title>Re: Fill in 0 for timechart with missing values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fill-in-0-for-timechart-with-missing-values/m-p/111959#M29386</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Try this simple Method&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;index=main startdaysago=10 | timechart span=1d count |fillnull&lt;/P&gt;</description>
      <pubDate>Tue, 27 Mar 2018 23:18:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fill-in-0-for-timechart-with-missing-values/m-p/111959#M29386</guid>
      <dc:creator>puma_splunk</dc:creator>
      <dc:date>2018-03-27T23:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: Fill in 0 for timechart with missing values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fill-in-0-for-timechart-with-missing-values/m-p/111960#M29387</link>
      <description>&lt;P&gt;This was way simpler for me. I'm not sure why you'd want to do a subsearch as in the accepted answer. Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 23:44:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fill-in-0-for-timechart-with-missing-values/m-p/111960#M29387</guid>
      <dc:creator>tdepuy</dc:creator>
      <dc:date>2018-04-18T23:44:38Z</dc:date>
    </item>
    <item>
      <title>Re: Fill in 0 for timechart with missing values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fill-in-0-for-timechart-with-missing-values/m-p/111961#M29388</link>
      <description>&lt;P&gt;this will work only when result count is greater than 0 and has null values in it but if result is 0 then this is not working&lt;/P&gt;</description>
      <pubDate>Mon, 25 Feb 2019 09:34:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fill-in-0-for-timechart-with-missing-values/m-p/111961#M29388</guid>
      <dc:creator>sureshkandi</dc:creator>
      <dc:date>2019-02-25T09:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: Fill in 0 for timechart with missing values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Fill-in-0-for-timechart-with-missing-values/m-p/558524#M158656</link>
      <description>&lt;P&gt;Hi, thank you for the response. It works, but what if I have multiple fields in my stats but only want to show 0s for one of them? Thank you very much!&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2021 10:54:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Fill-in-0-for-timechart-with-missing-values/m-p/558524#M158656</guid>
      <dc:creator>yvassilyeva</dc:creator>
      <dc:date>2021-07-07T10:54:21Z</dc:date>
    </item>
  </channel>
</rss>

