<?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: Comparing sum results between several days in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Comparing-sum-results-between-several-days/m-p/537339#M151897</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/230904"&gt;@KaitoKozo&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Please try below;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=power_consumption earliest=-3d@d
| timechart span=1d sum(consumption) as consumption
| streamstats window=2 current=f avg(consumption) as last2days
| tail 1
| where last2days&amp;gt;0 AND consumption&amp;gt;last2days*1.2&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 27 Jan 2021 04:19:15 GMT</pubDate>
    <dc:creator>scelikok</dc:creator>
    <dc:date>2021-01-27T04:19:15Z</dc:date>
    <item>
      <title>Comparing sum results between several days</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-sum-results-between-several-days/m-p/537335#M151894</link>
      <description>&lt;P&gt;I am trying to average the sum of power consumption readings between 2 days and compare that sum to a 3rd day. If the 3rd day’s total power consumption is 20% higher than the average of the previous 2 days, I would like to flag the day as having more power consumption than usual.&lt;/P&gt;&lt;P&gt;The main issue I have is in trying to do this comparison as I’m unsure if it’s possible to store data as variables similar to programming and am unable to do the full search/compute/compare in 1 line, in particular trying to target “specific dates relative to current date”.&lt;/P&gt;&lt;P&gt;I am having difficulty trying to implement my logic process in splunk as I am still relatively new to the system and am unsure about the capabilities and syntax of this platform.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 03:28:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-sum-results-between-several-days/m-p/537335#M151894</guid>
      <dc:creator>KaitoKozo</dc:creator>
      <dc:date>2021-01-27T03:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing sum results between several days</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-sum-results-between-several-days/m-p/537339#M151897</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/230904"&gt;@KaitoKozo&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Please try below;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=power_consumption earliest=-3d@d
| timechart span=1d sum(consumption) as consumption
| streamstats window=2 current=f avg(consumption) as last2days
| tail 1
| where last2days&amp;gt;0 AND consumption&amp;gt;last2days*1.2&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 04:19:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-sum-results-between-several-days/m-p/537339#M151897</guid>
      <dc:creator>scelikok</dc:creator>
      <dc:date>2021-01-27T04:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing sum results between several days</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-sum-results-between-several-days/m-p/537534#M151972</link>
      <description>&lt;P&gt;Thanks! This has helped a bunch! However, I'm now getting an error that it has the '&amp;gt;' operator received different types in the where command.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Through some testing, I have found out that the comparison of "Consumption &amp;gt; last2days*1.2" is the one causing issues, in particular "last2days*1.2". I am able to run the code if I change it to "Consumption &amp;gt; last2days", however the final result that appears is that Consumption is lesser than last2days.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KaitoKozo_0-1611803429908.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/12707i7148B1944A1727C3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KaitoKozo_0-1611803429908.png" alt="KaitoKozo_0-1611803429908.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This is the SS of the results that showed up when I added your modifications with "Consumption &amp;gt; last2days" instead.&lt;/P&gt;&lt;P&gt;Edit: I just digested and understood what the code does, so that 1 result was actually supposed to appear. Is there any way to create a chart that will plot those situations that only have days where the consumption is higher than the previous 2 days?&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2021 03:28:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-sum-results-between-several-days/m-p/537534#M151972</guid>
      <dc:creator>KaitoKozo</dc:creator>
      <dc:date>2021-01-28T03:28:13Z</dc:date>
    </item>
  </channel>
</rss>

