<?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: Timechart column statistics: Average of monthly project hours from index containing time sheet data in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Timechart-column-statistics-Average-of-monthly-project-hours/m-p/140322#M38753</link>
    <description>&lt;P&gt;I didn't include it in the question but you are correct that I only wanted to average over the number of projects that actually had charges in the month so your first suggestion is exactly what I was looking for. Thanks so much for your help.&lt;/P&gt;</description>
    <pubDate>Mon, 14 Jul 2014 12:53:06 GMT</pubDate>
    <dc:creator>doug_hall</dc:creator>
    <dc:date>2014-07-14T12:53:06Z</dc:date>
    <item>
      <title>Timechart column statistics: Average of monthly project hours from index containing time sheet data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-column-statistics-Average-of-monthly-project-hours/m-p/140320#M38751</link>
      <description>&lt;P&gt;I'm searching an index that contains time sheet data. Each event is a charge by an employee of some number of hours (hours_charged) against a project. I used the following to get a table of total hours by project per month&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=XXX | ... | timechart span=1month sum(hours_charged) by project_name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This produces a table like the following.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time     ProjectA ProjectB ProjectC ProjectD
2013-07   12.3     45.6     78.9     12.3
2013-08   12.7     44.1     77.1     13.2
...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is useful information but what I'm really after is the average of the monthly project hours. So I'm looking for a way to generate an average of the project columns in the timechart. Ideally the result would look like the following.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time     AvgHoursPerProject
2013-07   37.3
2012-08   36.8  
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is there a way to do this?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Doug&lt;/P&gt;</description>
      <pubDate>Sun, 13 Jul 2014 14:56:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-column-statistics-Average-of-monthly-project-hours/m-p/140320#M38751</guid>
      <dc:creator>doug_hall</dc:creator>
      <dc:date>2014-07-13T14:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart column statistics: Average of monthly project hours from index containing time sheet data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-column-statistics-Average-of-monthly-project-hours/m-p/140321#M38752</link>
      <description>&lt;P&gt;You could use this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | timechart span=1month sum(hours_charged) as hours dc(project_name) as projects | eval average_hours = hours / projects | fields - hours projects
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note, this will count the number of hours for each month individually... so if one month has four projects it'll build an average over four projects, and if another month only has one project it'll build an average over one project. Depending on your requirements that may be correct or not. If you need the number of projects to be the overall number of projects you can do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eventstats dc(project_name) as projects | timechart span=1month sum(hours_charged) as hours values(projects) as projects | eval average_hours = hours / projects | fields - hours projects
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That'll compute the number of projects over all months. Unwanted behaviour depending on your requirement could be a large number of short projects driving up the project count, lowering the averages for all months.&lt;/P&gt;</description>
      <pubDate>Sun, 13 Jul 2014 17:17:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-column-statistics-Average-of-monthly-project-hours/m-p/140321#M38752</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-07-13T17:17:33Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart column statistics: Average of monthly project hours from index containing time sheet data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-column-statistics-Average-of-monthly-project-hours/m-p/140322#M38753</link>
      <description>&lt;P&gt;I didn't include it in the question but you are correct that I only wanted to average over the number of projects that actually had charges in the month so your first suggestion is exactly what I was looking for. Thanks so much for your help.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jul 2014 12:53:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-column-statistics-Average-of-monthly-project-hours/m-p/140322#M38753</guid>
      <dc:creator>doug_hall</dc:creator>
      <dc:date>2014-07-14T12:53:06Z</dc:date>
    </item>
  </channel>
</rss>

