<?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: How to sum all values in a column using the &amp;quot;eval&amp;quot; command? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-sum-all-values-in-a-column-using-the-quot-eval-quot/m-p/356307#M105447</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;...your search here...
| eventstats sum(NumberCompleted) as total
| eval PercentageCompleted=(NumberCompleted/total)*100
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Eventstats will append a field "total" to each row, with the total of the Number column. That can then be used in an eval to calculate the completion per row.&lt;/P&gt;</description>
    <pubDate>Mon, 05 Feb 2018 15:57:32 GMT</pubDate>
    <dc:creator>FrankVl</dc:creator>
    <dc:date>2018-02-05T15:57:32Z</dc:date>
    <item>
      <title>How to sum all values in a column using the "eval" command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sum-all-values-in-a-column-using-the-quot-eval-quot/m-p/356306#M105446</link>
      <description>&lt;P&gt;I have a query in which each row represents statistics for an individual person. I want to sum up the entire amount for a certain column and then use that to show percentages for each person. &lt;/P&gt;

&lt;P&gt;Example:&lt;/P&gt;

&lt;P&gt;Person       |   Number Completed&lt;BR /&gt;
    x              |               20&lt;BR /&gt;
    y              |               30&lt;BR /&gt;
    z              |               50&lt;/P&gt;

&lt;P&gt;From here I would love the sum of &lt;CODE&gt;"Number Completed" (100)&lt;/CODE&gt; and then use that to add the field like so:&lt;/P&gt;

&lt;P&gt;Person     |    Number Completed    |     Percentage Completed&lt;BR /&gt;
    x            |                 20                      |                    20%&lt;BR /&gt;
    y            |                 30                      |                    30%&lt;BR /&gt;
    z             |                50                      |                    50%&lt;/P&gt;

&lt;P&gt;I am having trouble thinking of ways to do this without the eval command as I have already gathered statistics &lt;CODE&gt;"by Person"&lt;/CODE&gt; which is limiting me from gathering the statistics of the whole.&lt;/P&gt;

&lt;P&gt;If you could help me out that would be greatly appreciated. Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2018 15:26:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sum-all-values-in-a-column-using-the-quot-eval-quot/m-p/356306#M105446</guid>
      <dc:creator>mstrozyk25</dc:creator>
      <dc:date>2018-02-05T15:26:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum all values in a column using the "eval" command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sum-all-values-in-a-column-using-the-quot-eval-quot/m-p/356307#M105447</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;...your search here...
| eventstats sum(NumberCompleted) as total
| eval PercentageCompleted=(NumberCompleted/total)*100
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Eventstats will append a field "total" to each row, with the total of the Number column. That can then be used in an eval to calculate the completion per row.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2018 15:57:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sum-all-values-in-a-column-using-the-quot-eval-quot/m-p/356307#M105447</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-02-05T15:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum all values in a column using the "eval" command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sum-all-values-in-a-column-using-the-quot-eval-quot/m-p/356308#M105448</link>
      <description>&lt;P&gt;Try this run anywhere search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults|eval person="x", no="20"|append[|makeresults|eval person="y", no="30"]|append[|makeresults|eval person="z", no="50"]|table person no|stats values(no) as no by person|eventstats sum(no) as total|eval percentage=((no/total)*100)."%"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Feb 2018 15:59:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sum-all-values-in-a-column-using-the-quot-eval-quot/m-p/356308#M105448</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-05T15:59:03Z</dc:date>
    </item>
  </channel>
</rss>

