<?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: Stats as Percentages Of Total in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Stats-as-Percentages-Of-Total/m-p/138155#M37914</link>
    <description>&lt;P&gt;Hey,&lt;/P&gt;

&lt;P&gt;i tried this out, but Splunk tells me "no results found" after adding the eventstats &amp;amp; eval command.&lt;/P&gt;</description>
    <pubDate>Tue, 12 Nov 2013 13:05:59 GMT</pubDate>
    <dc:creator>HeinzWaescher</dc:creator>
    <dc:date>2013-11-12T13:05:59Z</dc:date>
    <item>
      <title>Stats as Percentages Of Total</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-as-Percentages-Of-Total/m-p/138153#M37912</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a search like this:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;search... | fields + user, country| stats dc(user) AS Users by country | sort - Users&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;The result is a table like this:&lt;/P&gt;

&lt;P&gt;Country A - 1000&lt;/P&gt;

&lt;P&gt;Country B - 500&lt;/P&gt;

&lt;P&gt;Country C - 500&lt;/P&gt;

&lt;P&gt;Is there an easy way to display the share per country in %?&lt;/P&gt;

&lt;P&gt;Country A - 50&lt;/P&gt;

&lt;P&gt;Country B - 25&lt;/P&gt;

&lt;P&gt;Country C - 25&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2013 09:26:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-as-Percentages-Of-Total/m-p/138153#M37912</guid>
      <dc:creator>HeinzWaescher</dc:creator>
      <dc:date>2013-11-12T09:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: Stats as Percentages Of Total</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-as-Percentages-Of-Total/m-p/138154#M37913</link>
      <description>&lt;P&gt;You can calculate a total distinct count and then divide your Users value by this to get a percentage.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search... | fields + user, country| eventstats dc(user) as totalcount | stats dc(user) AS Users by country | eval countrypercent=Users/totalcount*100 | sort - Users
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Nov 2013 11:04:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-as-Percentages-Of-Total/m-p/138154#M37913</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2013-11-12T11:04:57Z</dc:date>
    </item>
    <item>
      <title>Re: Stats as Percentages Of Total</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-as-Percentages-Of-Total/m-p/138155#M37914</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;

&lt;P&gt;i tried this out, but Splunk tells me "no results found" after adding the eventstats &amp;amp; eval command.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2013 13:05:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-as-Percentages-Of-Total/m-p/138155#M37914</guid>
      <dc:creator>HeinzWaescher</dc:creator>
      <dc:date>2013-11-12T13:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: Stats as Percentages Of Total</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-as-Percentages-Of-Total/m-p/138156#M37915</link>
      <description>&lt;P&gt;Neither eventstats nor eval filter events in any way so I suspect you're doing some other error. What does your search look like now?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2013 13:15:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-as-Percentages-Of-Total/m-p/138156#M37915</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2013-11-12T13:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: Stats as Percentages Of Total</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-as-Percentages-Of-Total/m-p/138157#M37916</link>
      <description>&lt;P&gt;It looks like this now:&lt;/P&gt;

&lt;P&gt;search...| fields + user&lt;/P&gt;

&lt;P&gt;| eventstats dc(user) as totalcount&lt;BR /&gt;
| stats dc(user) AS Users by Country&lt;BR /&gt;
| eval countrypercent=Users/totalcount*100&lt;/P&gt;

&lt;P&gt;This results in the original table including the total counts per Country. I also tried out to find the entries for totalcount with "| table totalcount". But there are no results&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2013 13:44:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-as-Percentages-Of-Total/m-p/138157#M37916</guid>
      <dc:creator>HeinzWaescher</dc:creator>
      <dc:date>2013-11-12T13:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: Stats as Percentages Of Total</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-as-Percentages-Of-Total/m-p/138158#M37917</link>
      <description>&lt;P&gt;The corrected query is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search... | fields + user, country| eventstats dc(user) as totalcount | stats dc(user) AS Users by country, totalcount | eval countrypercent=Users/totalcount*100 | sort - Users
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem with the original query is that it didn't pass totalcount in the stats statement.&lt;BR /&gt;
So the percentage could not be calculated.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2014 17:32:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-as-Percentages-Of-Total/m-p/138158#M37917</guid>
      <dc:creator>sansay</dc:creator>
      <dc:date>2014-06-12T17:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: Stats as Percentages Of Total</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-as-Percentages-Of-Total/m-p/138159#M37918</link>
      <description>&lt;P&gt;I downvoted this post because refined query in later post solves the problem.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2016 17:16:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-as-Percentages-Of-Total/m-p/138159#M37918</guid>
      <dc:creator>GeorgeStarkey</dc:creator>
      <dc:date>2016-12-02T17:16:42Z</dc:date>
    </item>
  </channel>
</rss>

