<?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: Calculating percentages over multiple counts in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Calculating-percentages-over-multiple-counts/m-p/403438#M116740</link>
    <description>&lt;P&gt;How do I approve? I don't see a button to do that?&lt;/P&gt;</description>
    <pubDate>Tue, 18 Jun 2019 11:29:32 GMT</pubDate>
    <dc:creator>hduncan7</dc:creator>
    <dc:date>2019-06-18T11:29:32Z</dc:date>
    <item>
      <title>Calculating percentages over multiple counts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculating-percentages-over-multiple-counts/m-p/403435#M116737</link>
      <description>&lt;P&gt;I'm trying to get percentages based on the number of logs per table. I want the results to look like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;**Table                   Count                    Percentage**
Total                     14392                    100
TBL1                      8302                     57.68
TBL2                      4293                     29.93
TBL3                      838                      5.82
TBL4                      639                      4.44
TBL5                      320                      2.22
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here's my search so far:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;text = "\*" (TBL1 OR TBL2 OR TBL3 OR TBL4 OR TBL5) | eventstats count AS Total
| append [search PAJYE text = "\*TBL1\*" | stats count | eval "Count Type" = "TBL1 Count" | eval "Percentage" = ((count/Total)\*100)]
| append [search PAJYE text = "\*TBL2\*" | stats count | eval "Count Type" = "TBL2 Count" | eval "Percentage" = ((count/Total)\*100)] 
| append [search PAJYE text = "\*TBL3\*" | stats count | eval "Count Type" = "TBL3 Count" | eval "Percentage" = ((count/Total)\*100)] 
| append [search PAJYE text = "\*TBL4\*" | stats count | eval "Count Type" = "TBL4 Count" | eval "Percentage" = ((count/Total)\*100)] 
| append [search PAJYE text = "\*TBL5\*" | stats count | eval "Count Type" = "TBL5 Count" | eval "Percentage" = ((count/Total)\*100)]
| append [search PAJYE text = "\*" (TBL1 OR TBL2 OR TBL3 OR TBL4 OR TBL5) | stats count | eval "Count Type" = "Total Count" | eval "Percentage" = ((count/Total)\*100)]
| rename count as "Count"
| sort - "Count"
| table "Count Type", "Count", "Percentage"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've tried so many different methods of trying to get this to work. My results are either a percentage column with no data, the counts get messed up, or pages of empty rows following my data.&lt;/P&gt;

&lt;P&gt;Any help would be appreciated. &lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 12:38:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculating-percentages-over-multiple-counts/m-p/403435#M116737</guid>
      <dc:creator>hduncan7</dc:creator>
      <dc:date>2019-06-04T12:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating percentages over multiple counts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculating-percentages-over-multiple-counts/m-p/403436#M116738</link>
      <description>&lt;P&gt;This should be easily simplified. &lt;/P&gt;

&lt;P&gt;Try: &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;&amp;lt;search&amp;gt; (TBL1 OR TBL2 OR TBL3 OR TBL4 OR TBL5)|rex "TBL(?P&amp;lt;table_number&amp;gt;\d+)" |stats count by table_number | eventstats sum(count) AS total | eval percent=(count/total)*100&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Once these results come in it can be refined to something useable. &lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 14:41:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculating-percentages-over-multiple-counts/m-p/403436#M116738</guid>
      <dc:creator>aromanauskas</dc:creator>
      <dc:date>2019-06-04T14:41:25Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating percentages over multiple counts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculating-percentages-over-multiple-counts/m-p/403437#M116739</link>
      <description>&lt;P&gt;Hi @hduncan7  ,&lt;/P&gt;

&lt;P&gt;Did you have a chance to check out any answers? If it worked, please resolve this post by approving it! If your problem is still not solved, keep us updated so that someone else can help you. &lt;/P&gt;

&lt;P&gt;Thanks for posting!&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 21:59:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculating-percentages-over-multiple-counts/m-p/403437#M116739</guid>
      <dc:creator>evania</dc:creator>
      <dc:date>2019-06-17T21:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating percentages over multiple counts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculating-percentages-over-multiple-counts/m-p/403438#M116740</link>
      <description>&lt;P&gt;How do I approve? I don't see a button to do that?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2019 11:29:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculating-percentages-over-multiple-counts/m-p/403438#M116740</guid>
      <dc:creator>hduncan7</dc:creator>
      <dc:date>2019-06-18T11:29:32Z</dc:date>
    </item>
  </channel>
</rss>

