<?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 do you tabulate a percentage of field value in a table? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-tabulate-a-percentage-of-field-value-in-a-table/m-p/602752#M209802</link>
    <description>&lt;P&gt;Thanks, just what i was looking for.&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jun 2022 08:49:46 GMT</pubDate>
    <dc:creator>becksyboy</dc:creator>
    <dc:date>2022-06-22T08:49:46Z</dc:date>
    <item>
      <title>How do you tabulate a percentage of field value in a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-tabulate-a-percentage-of-field-value-in-a-table/m-p/417007#M120009</link>
      <description>&lt;P&gt;My search shows each website category and the number of times each category was visited.  What I would like to create is a table that shows the percentage of all events by category rather than the count.  I don't know why, but I'm getting &lt;CODE&gt;no results found&lt;/CODE&gt; with my existing SPL.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;sample data&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;category      count
streaming     50
reference     13
social media  150
gaming        37
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;desired output&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;category      percentage
streaming     25.0
reference     6.5
social media  75.0
gaming        18.5
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;current SPL&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=web
| stats count as grand_total
| stats count by category as cat_total
| eval percentage = round((cat_total/grand_total)*100,1)
| table category percentage
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 02 Dec 2018 16:48:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-tabulate-a-percentage-of-field-value-in-a-table/m-p/417007#M120009</guid>
      <dc:creator>DEAD_BEEF</dc:creator>
      <dc:date>2018-12-02T16:48:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do you tabulate a percentage of field value in a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-tabulate-a-percentage-of-field-value-in-a-table/m-p/417008#M120010</link>
      <description>&lt;P&gt;@DEAD_BEEF , are you looking for something like the following?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=web
| stats count as cat_total by category
| eventstats sum(cat_total) as grand_total 
| eval percentage = round((cat_total/grand_total)*100,1) 
| table category percentage
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 02 Dec 2018 17:11:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-tabulate-a-percentage-of-field-value-in-a-table/m-p/417008#M120010</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-12-02T17:11:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do you tabulate a percentage of field value in a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-tabulate-a-percentage-of-field-value-in-a-table/m-p/417009#M120011</link>
      <description>&lt;P&gt;Exactly what I was looking for.  I didn't think of using the value from stats and passing it to eventstats.  Thank you!!&lt;/P&gt;</description>
      <pubDate>Sun, 02 Dec 2018 17:23:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-tabulate-a-percentage-of-field-value-in-a-table/m-p/417009#M120011</guid>
      <dc:creator>DEAD_BEEF</dc:creator>
      <dc:date>2018-12-02T17:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do you tabulate a percentage of field value in a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-tabulate-a-percentage-of-field-value-in-a-table/m-p/602752#M209802</link>
      <description>&lt;P&gt;Thanks, just what i was looking for.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2022 08:49:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-tabulate-a-percentage-of-field-value-in-a-table/m-p/602752#M209802</guid>
      <dc:creator>becksyboy</dc:creator>
      <dc:date>2022-06-22T08:49:46Z</dc:date>
    </item>
  </channel>
</rss>

