<?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 timechart: average out value over missing time in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/timechart-average-out-value-over-missing-time/m-p/284372#M85984</link>
    <description>&lt;P&gt;I have bills that come in at irregular periods.  Here is an example for 1 type:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{name:building1Water, startDate:2015-12-30, Cost:300}
{name:building1Water, startDate:2015-09-30, Cost:100}
{name:building1Water, startDate:2015-08-30, Cost:100} 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In this example, the bill for 2015-12-30 covers the months of December ($100) , November($100), and October($100).  I would like to average out the Cost over the missing months.  What would be the timechart syntax for this?&lt;/P&gt;

&lt;P&gt;I would like to see:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; 2015-12   building1Water   100
 2015-11   building1Water   100
 2015-10   building1Water   100
 2015-09   building1Water   100
 2015-08   building1Water   100
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 31 May 2016 14:07:01 GMT</pubDate>
    <dc:creator>suarezry</dc:creator>
    <dc:date>2016-05-31T14:07:01Z</dc:date>
    <item>
      <title>timechart: average out value over missing time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-average-out-value-over-missing-time/m-p/284372#M85984</link>
      <description>&lt;P&gt;I have bills that come in at irregular periods.  Here is an example for 1 type:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{name:building1Water, startDate:2015-12-30, Cost:300}
{name:building1Water, startDate:2015-09-30, Cost:100}
{name:building1Water, startDate:2015-08-30, Cost:100} 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In this example, the bill for 2015-12-30 covers the months of December ($100) , November($100), and October($100).  I would like to average out the Cost over the missing months.  What would be the timechart syntax for this?&lt;/P&gt;

&lt;P&gt;I would like to see:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; 2015-12   building1Water   100
 2015-11   building1Water   100
 2015-10   building1Water   100
 2015-09   building1Water   100
 2015-08   building1Water   100
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 May 2016 14:07:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-average-out-value-over-missing-time/m-p/284372#M85984</guid>
      <dc:creator>suarezry</dc:creator>
      <dc:date>2016-05-31T14:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: timechart: average out value over missing time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-average-out-value-over-missing-time/m-p/284373#M85985</link>
      <description>&lt;P&gt;What are you expecting to see as a resulting dataset to graph?&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2016 14:14:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-average-out-value-over-missing-time/m-p/284373#M85985</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-05-31T14:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: timechart: average out value over missing time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-average-out-value-over-missing-time/m-p/284374#M85986</link>
      <description>&lt;P&gt;Thanks woodcock.  I have updated my question to indicate what I would like to see.&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2016 14:34:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-average-out-value-over-missing-time/m-p/284374#M85986</guid>
      <dc:creator>suarezry</dc:creator>
      <dc:date>2016-05-31T14:34:21Z</dc:date>
    </item>
    <item>
      <title>Re: timechart: average out value over missing time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-average-out-value-over-missing-time/m-p/284375#M85987</link>
      <description>&lt;P&gt;Try like this (assuming _time is set based on startDate field)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | timechart span=1mon values(Cost) as Cost | streamstats current=f window=1 values(_time) as prev_time | eval days=(strftime(_time,"%m")-strftime(prev_time,"%m") | eval Cost=Cost/days | eval temp=mvrange(0,days,1) | mvexpand temp | eval _time=relative_time(_time,"-".temp."mon@mon") | table _time Cost
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 May 2016 15:01:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-average-out-value-over-missing-time/m-p/284375#M85987</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-05-31T15:01:36Z</dc:date>
    </item>
    <item>
      <title>Re: timechart: average out value over missing time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/timechart-average-out-value-over-missing-time/m-p/284376#M85988</link>
      <description>&lt;P&gt;That is exactly what I needed!  timechart the cost per day!  modifying _time with relative_time was new to me.  Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:50:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/timechart-average-out-value-over-missing-time/m-p/284376#M85988</guid>
      <dc:creator>suarezry</dc:creator>
      <dc:date>2020-09-29T09:50:45Z</dc:date>
    </item>
  </channel>
</rss>

