<?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: Percentage Eval in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Percentage-Eval/m-p/79126#M20016</link>
    <description>&lt;P&gt;I know the math points to total_count being equal to 0 but Splunk reports it as being equal to 1. Hence my confusion.&lt;/P&gt;</description>
    <pubDate>Wed, 02 Oct 2013 03:25:40 GMT</pubDate>
    <dc:creator>justinfranks</dc:creator>
    <dc:date>2013-10-02T03:25:40Z</dc:date>
    <item>
      <title>Percentage Eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Percentage-Eval/m-p/79124#M20014</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;There are a lot of percentage questions on this forum but I already know how percentages work but the Eval doesn't seem to work. I will explain.&lt;/P&gt;

&lt;P&gt;Here is my search query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="Test" | reverse | delta TimeStamp AS timeDeltaS p=1 | eval timeDeltaS=abs(timeDeltaS) | eval counter=round(timeDeltaS / 900) | eval to_add=if(counter &amp;gt; 1, (counter - 1), 0) | accum to_add as total_count | eval counter=1 | accum counter as max_count | eval perc=((max_count - total_count) / max_count) | stats max(perc), max(total_count), max(max_count), count(FilesOpen)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which returns:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;max(perc)   max(total_count)    max(max_count)  count(FilesOpen)
1.000000    1                   226             226
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As you can see, the perc field is not returning a percentage, it is essentially 100%, but should be around 99% not 100%. However, when I swap total_count with an actual number, &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="Test" | reverse | delta TimeStamp AS timeDeltaS p=1 | eval timeDeltaS=abs(timeDeltaS) | eval counter=round(timeDeltaS / 900) | eval to_add=if(counter &amp;gt; 1, (counter - 1), 0) | accum to_add as total_count | eval counter=1 | accum counter as max_count | eval perc=((max_count - 1) / max_count) | stats max(perc), max(total_count), max(max_count), count(FilesOpen)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I get this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;max(perc)   max(total_count)    max(max_count)  count(FilesOpen)
0.995633    1                   229             229
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2013 00:34:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Percentage-Eval/m-p/79124#M20014</guid>
      <dc:creator>justinfranks</dc:creator>
      <dc:date>2013-10-02T00:34:43Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage Eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Percentage-Eval/m-p/79125#M20015</link>
      <description>&lt;P&gt;Isn't total_count 0?&lt;/P&gt;

&lt;P&gt;perc=((max_count - total_count) / max_count)&lt;BR /&gt;
first:1-0/1=1.000000&lt;BR /&gt;
last:226-1/226=0.995575&lt;/P&gt;

&lt;P&gt;perc=((max_count - 1) / max_count)&lt;BR /&gt;
first:1-1/1=0.000000&lt;BR /&gt;
last:229-1/229=0.995633&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:52:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Percentage-Eval/m-p/79125#M20015</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2020-09-28T14:52:33Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage Eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Percentage-Eval/m-p/79126#M20016</link>
      <description>&lt;P&gt;I know the math points to total_count being equal to 0 but Splunk reports it as being equal to 1. Hence my confusion.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2013 03:25:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Percentage-Eval/m-p/79126#M20016</guid>
      <dc:creator>justinfranks</dc:creator>
      <dc:date>2013-10-02T03:25:40Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage Eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Percentage-Eval/m-p/79127#M20017</link>
      <description>&lt;P&gt;I do not think that there is a bug in the calculation of the number of significant digits of SPLUNK. &lt;/P&gt;

&lt;P&gt;(I want you to check all the lines here)&lt;BR /&gt;
sourcetype="Test" | reverse | delta TimeStamp AS timeDeltaS p=1 | eval timeDeltaS=abs(timeDeltaS) | eval counter=round(timeDeltaS / 900) | eval to_add=if(counter &amp;gt; 1, (counter - 1), 0) | accum to_add as total_count | eval counter=1 | accum counter as max_count | eval perc=((max_count - total_count) / max_count)&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:52:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Percentage-Eval/m-p/79127#M20017</guid>
      <dc:creator>HiroshiSatoh</dc:creator>
      <dc:date>2020-09-28T14:52:36Z</dc:date>
    </item>
  </channel>
</rss>

