<?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 avg() does not consider all days. in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/616967#M50675</link>
    <description>&lt;P&gt;Why you don't use&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| timechart span=1d distinct_count(Task) as Count by Group
| stats avg(*) as Average_*
| foreach * 
    [ eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; = round('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;', 2)]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;With my test data I get same results with this and my previous example. Please check that those field names are correct as I tested it with different events.&lt;/P&gt;</description>
    <pubDate>Thu, 13 Oct 2022 10:53:46 GMT</pubDate>
    <dc:creator>isoutamo</dc:creator>
    <dc:date>2022-10-13T10:53:46Z</dc:date>
    <item>
      <title>How can my search consider all days?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/616911#M50663</link>
      <description>&lt;P&gt;Hi all, i am finding average per day for some of the data. My search looks like this.&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;| bucket _time span=1d
| stats distinct_count(Task) as counts by _time Group| stats avg(counts) as AverageCountPerDay by Group&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was able to get the results but the problem is the stats avg does not consider the day in which there is no "Task". I want my search to consider all the days. How can i achieve this?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 13:54:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/616911#M50663</guid>
      <dc:creator>anooshac</dc:creator>
      <dc:date>2022-10-18T13:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: stats avg() does not consider all days.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/616925#M50664</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;you can try this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| bucket _time span=1d
| stats distinct_count(Task) as counts by _time Group
| makecontinuous _time span=1d
| fillnull value=NULL Group
| fillnull value=0 counts
| stats avg(counts) as AverageCountPerDay by Group&lt;/LI-CODE&gt;&lt;P&gt;If needed you could drop first fill null away if you don't need it.&lt;/P&gt;&lt;P&gt;r. Ismo&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 08:13:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/616925#M50664</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2022-10-13T08:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: stats avg() does not consider all days.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/616933#M50665</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214410"&gt;@isoutamo&lt;/a&gt; , tried it but the result i am getting is same.. It does not consider the day in which there is no "Task".&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 08:30:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/616933#M50665</guid>
      <dc:creator>anooshac</dc:creator>
      <dc:date>2022-10-13T08:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: stats avg() does not consider all days.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/616944#M50666</link>
      <description>&lt;P&gt;Sorry my misunderstanding. Maybe this is what you are looking for&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| bucket _time span=1d
| stats distinct_count(Task) as counts by _time Group
| makecontinuous _time span=1d
| eventstats values(Group) as grp
| eval Group=coalesce(Group, grp)
| fields - grp
| fillnull value=0 counts
| mvexpand Group
| stats avg(counts) as AverageCountPerDay by Group&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 13 Oct 2022 09:02:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/616944#M50666</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2022-10-13T09:02:42Z</dc:date>
    </item>
    <item>
      <title>Re: stats avg() does not consider all days.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/616954#M50668</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214410"&gt;@isoutamo&lt;/a&gt; , still it is giving&amp;nbsp; different values.&lt;/P&gt;&lt;P&gt;For finding out the average separately i use the following query. This is finding out the average separately for the "Group".&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|timechart span=1d distinct_count(Task) as Count| stats avg(Count) as Average&lt;/LI-CODE&gt;&lt;P&gt;My data has different "Group", so i want to create a table for the Group and the averages. But the timechart is not working if used for the groups.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 09:28:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/616954#M50668</guid>
      <dc:creator>anooshac</dc:creator>
      <dc:date>2022-10-13T09:28:12Z</dc:date>
    </item>
    <item>
      <title>Re: stats avg() does not consider all days.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/616967#M50675</link>
      <description>&lt;P&gt;Why you don't use&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| timechart span=1d distinct_count(Task) as Count by Group
| stats avg(*) as Average_*
| foreach * 
    [ eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; = round('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;', 2)]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;With my test data I get same results with this and my previous example. Please check that those field names are correct as I tested it with different events.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 10:53:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/616967#M50675</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2022-10-13T10:53:46Z</dc:date>
    </item>
    <item>
      <title>Re: stats avg() does not consider all days.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/616969#M50676</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| bucket _time span=1d
| chart dc(Task) as counts by _time Group
| eventstats min(_time) as start
| eval bin=floor((_time-start)/(60*60*24))
| makecontinuous bin
| filldown start
| eval _time=start+(bin*60*60*24)
| fillnull value=0
| fields - bin start
| untable _time Group counts
| stats avg(counts) as AverageCountPerDay by Group&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 13 Oct 2022 11:13:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/616969#M50676</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-10-13T11:13:19Z</dc:date>
    </item>
    <item>
      <title>Re: stats avg() does not consider all days.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/617510#M50715</link>
      <description>&lt;P&gt;hi, &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt; i tried and the table only has averages for few Groups. It doesn't show averages for all the groups.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 10:52:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/617510#M50715</guid>
      <dc:creator>anooshac</dc:creator>
      <dc:date>2022-10-18T10:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: stats avg() does not consider all days.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/617512#M50716</link>
      <description>&lt;P&gt;Hi , &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214410"&gt;@isoutamo&lt;/a&gt; tried this and i am not able to produce the average for all the Groups. Also is there a way to put these values as Group and Average as columns in a table?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 11:04:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/617512#M50716</guid>
      <dc:creator>anooshac</dc:creator>
      <dc:date>2022-10-18T11:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: stats avg() does not consider all days.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/617586#M50720</link>
      <description>&lt;P&gt;Can you share you full search? (In a code block &amp;lt;/&amp;gt; preferably)&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 20:39:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/617586#M50720</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-10-18T20:39:24Z</dc:date>
    </item>
    <item>
      <title>Re: stats avg() does not consider all days.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/617658#M50723</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt; , This is my sample data. This is only for one Task_no. There are many Tasks under a Group, likewise there are many Groups also.&lt;/P&gt;&lt;PRE&gt;"Task_no":"5",

"Group": "G1",

"EXECUTION_DATE":1648081994535,

"STATUS":"FAILURE",

"DURATION":1951628&lt;/PRE&gt;&lt;P&gt;And this is the search i'm using,&lt;/P&gt;&lt;PRE&gt;| bucket _time span=1d
| stats distinct_count(Task) as counts by _time Group| stats avg(counts) as AverageCountPerDay by Group&lt;/PRE&gt;&lt;P&gt;Actually i have table which combines all some of the calculated data using JOIN. The query is too big so only posted the search for the average. I have been trying to calculate average and trying to combine the data to my table. But the query which i used does not give the values correctly. I find the averages separately for a Group like this,&lt;/P&gt;&lt;PRE&gt;|timechart span=1d distinct_count(Task) as Count| stats avg(Count) as Average&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2022 08:01:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/617658#M50723</guid>
      <dc:creator>anooshac</dc:creator>
      <dc:date>2022-10-19T08:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: stats avg() does not consider all days.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/617664#M50724</link>
      <description>&lt;P&gt;Timechart will fill in the blanks in your time range so you could end up with zeroes for some days. This will bring the average down, when compared to taking the average of the non-zero counts that stats is giving you. Is this the reason for the "incorrect" averages?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2022 09:15:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/617664#M50724</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-10-19T09:15:50Z</dc:date>
    </item>
    <item>
      <title>Re: stats avg() does not consider all days.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/618200#M50769</link>
      <description>&lt;P&gt;Yes. I guess that is the reason for the incorrect values. Any idea in how to resolve this? Or is it possible for to find averages for all the Groups together by any other way?&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 04:40:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/618200#M50769</guid>
      <dc:creator>anooshac</dc:creator>
      <dc:date>2022-10-25T04:40:06Z</dc:date>
    </item>
    <item>
      <title>Re: stats avg() does not consider all days.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/618203#M50770</link>
      <description>&lt;P&gt;I am not sure what you are trying to resolve - do you want the average from stats (without the days with zeroes being included) or the average from timechart (with the days with zeroes being included)? (The answer is in the question!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;)&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 05:31:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/618203#M50770</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-10-25T05:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: stats avg() does not consider all days.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/618214#M50771</link>
      <description>&lt;P&gt;I want to find the averages together with the days with zeroes being included..&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2022 08:22:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/618214#M50771</guid>
      <dc:creator>anooshac</dc:creator>
      <dc:date>2022-10-25T08:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: stats avg() does not consider all days.</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/618216#M50772</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| bucket _time span=1d
| chart dc(Task) as counts useother=f limit=0 by _time Group
| eventstats min(_time) as start
| eval bin=floor((_time-start)/(60*60*24))
| makecontinuous bin
| filldown start
| eval _time=start+(bin*60*60*24)
| fillnull value=0
| fields - bin start
| untable _time Group counts
| stats avg(counts) as AverageCountPerDay by Group&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 25 Oct 2022 08:34:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-my-search-consider-all-days/m-p/618216#M50772</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-10-25T08:34:24Z</dc:date>
    </item>
  </channel>
</rss>

