<?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 Editing current finding variance search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Editing-current-finding-variance-search/m-p/651221#M225145</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have an search that is used on a dashboard that I would like tweaked.&lt;/P&gt;&lt;P&gt;Currently this search/panel displays the variance of current hour over the same hour the week before. for example: The value at hour 10 on Wed 7/19/23 will be compared to the value at hour 10 on Wed 7/12/23 and give variance.&lt;/P&gt;&lt;P&gt;Instead, I would like to compare current hour value to the value of the AVG of that same hour over the last 2 weeks (instead of compared to 1 day). For example I would like hour 10 on Wed 7/19/23 to be compared to the avg of hour 10 each day from Tues 7/18/23 to Wed 7/5/23.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bryhoffman_0-1689801500388.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/26353iE395266881DE8AF1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="bryhoffman_0-1689801500388.png" alt="bryhoffman_0-1689801500388.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Current search:&lt;/P&gt;&lt;P&gt;| tstats count where index=msexchange host=SMEXCH13* earliest=-14d@d latest=-13d@d by _time span=1h&lt;BR /&gt;| eval hour=strftime(_time,"%H")&lt;BR /&gt;| eval ReportKey="2weekprior"&lt;BR /&gt;| stats values(count) as count by hour, ReportKey&lt;BR /&gt;| append&lt;BR /&gt;[| tstats count where index=msexchange host=SMEXCH13* earliest=-7d@d latest=-6d@d by _time span=1h&lt;BR /&gt;| eval hour=strftime(_time,"%H")&lt;BR /&gt;| eval ReportKey="1weekprior"&lt;BR /&gt;| stats values(count) as count by hour, ReportKey ]&lt;BR /&gt;| append&lt;BR /&gt;[| tstats count where index=msexchange host=SMEXCH13* earliest=-0d@d latest=-0h@h by _time span=1h&lt;BR /&gt;| eval hour=strftime(_time,"%H")&lt;BR /&gt;| eval ReportKey="currentweek"&lt;BR /&gt;| stats values(count) as count by hour, ReportKey ]&lt;BR /&gt;| eval currenthour=strftime(_time,"%H")&lt;BR /&gt;| xyseries hour, ReportKey, count&lt;BR /&gt;| eval nowhour = strftime(now(),"%H")&lt;BR /&gt;| eval comparehour = nowhour-1&lt;BR /&gt;|where hour&amp;lt;=comparehour&lt;BR /&gt;|sort by -hour&lt;BR /&gt;| table hour,nowhour,comparehour, currentweek,1weekprior,2weekprior&lt;BR /&gt;|eval 1weekvar = currentweek/'1weekprior'&lt;BR /&gt;|eval 2weekvar = currentweek/'2weekprior'&lt;BR /&gt;|eval variance=round(((('1weekvar'+'2weekvar')/2)*100)-100,2)&lt;BR /&gt;|table hour,variance&lt;BR /&gt;|head 5&lt;/P&gt;</description>
    <pubDate>Wed, 19 Jul 2023 21:18:53 GMT</pubDate>
    <dc:creator>bryhoffman</dc:creator>
    <dc:date>2023-07-19T21:18:53Z</dc:date>
    <item>
      <title>Editing current finding variance search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Editing-current-finding-variance-search/m-p/651221#M225145</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have an search that is used on a dashboard that I would like tweaked.&lt;/P&gt;&lt;P&gt;Currently this search/panel displays the variance of current hour over the same hour the week before. for example: The value at hour 10 on Wed 7/19/23 will be compared to the value at hour 10 on Wed 7/12/23 and give variance.&lt;/P&gt;&lt;P&gt;Instead, I would like to compare current hour value to the value of the AVG of that same hour over the last 2 weeks (instead of compared to 1 day). For example I would like hour 10 on Wed 7/19/23 to be compared to the avg of hour 10 each day from Tues 7/18/23 to Wed 7/5/23.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bryhoffman_0-1689801500388.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/26353iE395266881DE8AF1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="bryhoffman_0-1689801500388.png" alt="bryhoffman_0-1689801500388.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Current search:&lt;/P&gt;&lt;P&gt;| tstats count where index=msexchange host=SMEXCH13* earliest=-14d@d latest=-13d@d by _time span=1h&lt;BR /&gt;| eval hour=strftime(_time,"%H")&lt;BR /&gt;| eval ReportKey="2weekprior"&lt;BR /&gt;| stats values(count) as count by hour, ReportKey&lt;BR /&gt;| append&lt;BR /&gt;[| tstats count where index=msexchange host=SMEXCH13* earliest=-7d@d latest=-6d@d by _time span=1h&lt;BR /&gt;| eval hour=strftime(_time,"%H")&lt;BR /&gt;| eval ReportKey="1weekprior"&lt;BR /&gt;| stats values(count) as count by hour, ReportKey ]&lt;BR /&gt;| append&lt;BR /&gt;[| tstats count where index=msexchange host=SMEXCH13* earliest=-0d@d latest=-0h@h by _time span=1h&lt;BR /&gt;| eval hour=strftime(_time,"%H")&lt;BR /&gt;| eval ReportKey="currentweek"&lt;BR /&gt;| stats values(count) as count by hour, ReportKey ]&lt;BR /&gt;| eval currenthour=strftime(_time,"%H")&lt;BR /&gt;| xyseries hour, ReportKey, count&lt;BR /&gt;| eval nowhour = strftime(now(),"%H")&lt;BR /&gt;| eval comparehour = nowhour-1&lt;BR /&gt;|where hour&amp;lt;=comparehour&lt;BR /&gt;|sort by -hour&lt;BR /&gt;| table hour,nowhour,comparehour, currentweek,1weekprior,2weekprior&lt;BR /&gt;|eval 1weekvar = currentweek/'1weekprior'&lt;BR /&gt;|eval 2weekvar = currentweek/'2weekprior'&lt;BR /&gt;|eval variance=round(((('1weekvar'+'2weekvar')/2)*100)-100,2)&lt;BR /&gt;|table hour,variance&lt;BR /&gt;|head 5&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2023 21:18:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Editing-current-finding-variance-search/m-p/651221#M225145</guid>
      <dc:creator>bryhoffman</dc:creator>
      <dc:date>2023-07-19T21:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: Editing current finding variance search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Editing-current-finding-variance-search/m-p/651261#M225164</link>
      <description>&lt;P&gt;The search is a lot simpler if we just follow your description of the problem:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats count where index=msexchange host=SMEXCH13* earliest=-2w@d latest=-0h@h by _time span=1h
| eval hour = strftime(_time,"%H")
| eval interval = if(_time &amp;gt; relative_time(now(), "-0d@d"), "today", "past2weeks")
| stats avg(count) as count by hour interval
| xyseries hour interval count
| where isnotnull(today)
| eval variance = round((today / past2weeks - 1) * 100, 2)
| fields - count interval&lt;/LI-CODE&gt;&lt;P&gt;Note:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;The past2weeks calculation does not include today's. &amp;nbsp;In most cases, this is acceptable but today's can be included if necessary.&lt;/LI&gt;&lt;LI&gt;The "variance" calculation is based on your description and the sample code you provided, namely, the percentage difference between today's value and the mean value in the past two weeks. &amp;nbsp;This is not the common mathematical definition of variance; and the value can be negative.&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Thu, 20 Jul 2023 08:59:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Editing-current-finding-variance-search/m-p/651261#M225164</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-07-20T08:59:54Z</dc:date>
    </item>
  </channel>
</rss>

