<?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 calculate percentage in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percentage/m-p/177497#M51045</link>
    <description>&lt;P&gt;Thank you so much; its working&lt;/P&gt;</description>
    <pubDate>Fri, 21 Aug 2015 15:53:08 GMT</pubDate>
    <dc:creator>Laya123</dc:creator>
    <dc:date>2015-08-21T15:53:08Z</dc:date>
    <item>
      <title>how to calculate percentage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percentage/m-p/177488#M51036</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Can anyone help how to calculate percentage for the report below for &lt;STRONG&gt;'%Act_fail_G_Total'&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;host                Act-Sucess               Act-Fail            Pub-Sucess                 Laun-Sucess    Total            %Act-fai_Total      %Act_fail_G_Total&lt;BR /&gt;
A                                   1                               1                           1                                   1                    4                    25                             50&lt;BR /&gt;
B                                   2                               0                           3                                    2                   7                     0                               0&lt;BR /&gt;
C                                   1                                1                           2                                   4                    8                   12.5                          50&lt;BR /&gt;&lt;BR /&gt;
D                                   3                               0                            1                                   1                    5                   0                                0&lt;BR /&gt;
G_Total                         7                                2                            7                                  8                   24                  8.3                           100 &lt;/P&gt;

&lt;P&gt;Using the search below, I am able to get the report till &lt;STRONG&gt;%Act-fai_GTotal&lt;/STRONG&gt;, but I am unable to get the &lt;STRONG&gt;%Act_fail_Total&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|inputlookup _AAD.csv |where Status="Act" OR Status="Pub" OR Status="Laun" OR Status="Fail"|eval app_status = AAtype . ":" . Status | chart count over host by app_status usenull=f| addtotals | addcoltotals labelfield=host label=G_Total|foreach *Activate:Failed [eval  failed_by_total_Publish = '&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;' * 100 / Total]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can anyone help me to do this?&lt;/P&gt;

&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:01:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percentage/m-p/177488#M51036</guid>
      <dc:creator>Laya123</dc:creator>
      <dc:date>2020-09-29T07:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: how to calculate percentage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percentage/m-p/177489#M51037</link>
      <description>&lt;P&gt;I do not think anyone will make an effort to try to answer this question until you give us some sample raw data.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Aug 2015 00:16:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percentage/m-p/177489#M51037</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-08-20T00:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: how to calculate percentage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percentage/m-p/177490#M51038</link>
      <description>&lt;P&gt;Sorry for the inconvenience&lt;/P&gt;

&lt;P&gt;here is the raw data&lt;/P&gt;

&lt;P&gt;host        Act type    STATUS&lt;BR /&gt;
A       Activate    Failed&lt;BR /&gt;
B       Publish Success&lt;BR /&gt;
A       Activate    Failed&lt;BR /&gt;
C       Activate    Failed&lt;BR /&gt;
B       Activate    Success&lt;BR /&gt;
A       Activate    Success&lt;BR /&gt;
C       Launch  Success&lt;BR /&gt;
B        Activate   Success &lt;/P&gt;

&lt;P&gt;I want my report like&lt;/P&gt;

&lt;P&gt;host         Activate                  Publish      Launch               Grand  % of Activate failed    % of Activate failed &lt;BR /&gt;
         Success    Failed  Success   Failed    Success    Failed     Total upon GrandTotal           upon Total&lt;BR /&gt;
A             1            2                 0               0               0          0         3          66.7                            66.7&lt;BR /&gt;
B             2            0                 1               0               0                  0         3           0                                  0.0&lt;BR /&gt;
C             0            1                 0               0               1                  0         2           50                                     33.3&lt;BR /&gt;
Total     3            3                 1               0               1              0         8          37.5                            100&lt;/P&gt;

&lt;P&gt;Using the search below, I am able to get the report till &lt;STRONG&gt;'% of Activate failed upon GrandTotal'&lt;/STRONG&gt;, but I am unable to get the &lt;STRONG&gt;% of Activate failed upon Total&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Query:&lt;/P&gt;

&lt;P&gt;|inputlookup _AAD.csv |where Status="Act" OR Status="Pub" OR Status="Laun" OR Status="Fail"|eval app_status = AAtype . ":" . Status | chart count over host by app_status usenull=f| addtotals | addcoltotals labelfield=host label=G_Total|foreach *Activate:Failed [eval  failed_by_total_Publish = '&amp;lt;&amp;gt;' * 100 / Total]&lt;/P&gt;

&lt;P&gt;Hope now i have given proper information&lt;/P&gt;

&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:05:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percentage/m-p/177490#M51038</guid>
      <dc:creator>Laya123</dc:creator>
      <dc:date>2020-09-29T07:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: how to calculate percentage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percentage/m-p/177491#M51039</link>
      <description>&lt;P&gt;What should be the formula/value for %Act_fail_G_Total', based on your sample data??&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:05:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percentage/m-p/177491#M51039</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-29T07:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: how to calculate percentage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percentage/m-p/177492#M51040</link>
      <description>&lt;P&gt;It is closer but I have more questions than ever:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;I do not see a field &lt;CODE&gt;AAtype&lt;/CODE&gt; in your raw data.&lt;/LI&gt;
&lt;LI&gt;I have no idea how to read the header-line (field-names) of your desired report (I think because some/all of the names have newlines in them).&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Thu, 20 Aug 2015 22:28:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percentage/m-p/177492#M51040</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-08-20T22:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: how to calculate percentage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percentage/m-p/177493#M51041</link>
      <description>&lt;P&gt;Thank you so much for your response.&lt;/P&gt;

&lt;P&gt;AA type is Acttype in my raw data&lt;/P&gt;

&lt;P&gt;I want my report like &lt;/P&gt;

&lt;P&gt;Host   Activate_Success    &lt;EM&gt;Activate_Failed&lt;/EM&gt;  Publish_Success    Publish_Failed      Total     '%failed'&lt;BR /&gt;
  A                3                                 2                                   1                               0                   6&lt;BR /&gt;&lt;BR /&gt;
  B                0                                 1                                   1                               0                   2&lt;BR /&gt;
  C                2                                 0                                   2                               1                   5&lt;BR /&gt;&lt;BR /&gt;
Total            5                                 3                                  4                                5                 13 &lt;BR /&gt;
   I want to calculate *&lt;EM&gt;%failed&lt;/EM&gt; from  'Activate_failed' Host wise from the above example total Activate_Failed  cases are 3 and i want percentage of each Host like A-66.6%  and For B-33.3% and for C-0.0%  Total-100%&lt;/P&gt;

&lt;P&gt;I hope this make sense&lt;/P&gt;

&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:03:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percentage/m-p/177493#M51041</guid>
      <dc:creator>Laya123</dc:creator>
      <dc:date>2020-09-29T07:03:13Z</dc:date>
    </item>
    <item>
      <title>Re: how to calculate percentage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percentage/m-p/177494#M51042</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;i think you want something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count by host "Act type" STATUS | eval new_field = 'Act type'." ".'STATUS' | chart max(count) by host new_field | fillnull | addtotals | eval perc_failed = 'Activate Failed' / Total  * 100
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is a run every example, just copy and past it in your search bar:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count | eval host="A" | eval "Act type"="Activate" | eval STATUS="Failed" | append[| stats count | eval host="B" | eval "Act type"="Publish" | eval STATUS="Success"] | append[| stats count | eval host="A" | eval "Act type"="Activate" | eval STATUS="Failed"] | append[| stats count | eval host="C" | eval "Act type"="Activate" | eval STATUS="Failed"] | append[| stats count | eval host="B" | eval "Act type"="Activate" | eval STATUS="Success"] | append[| stats count | eval host="A" | eval "Act type"="Activate" | eval STATUS="Success"] | append[| stats count | eval host="C" | eval "Act type"="Launch" | eval STATUS="Success"] | append[| stats count | eval host="B" | eval "Act type"="Activate" | eval STATUS="Success"] | table host "Act type" STATUS | stats count by host "Act type" STATUS | eval new_field = 'Act type'." ".'STATUS' | chart max(count) by host new_field | fillnull | addtotals | eval perc_failed = 'Activate Failed' / Total  * 100
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Aug 2015 08:44:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percentage/m-p/177494#M51042</guid>
      <dc:creator>tom_frotscher</dc:creator>
      <dc:date>2015-08-21T08:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: how to calculate percentage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percentage/m-p/177495#M51043</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Thanks for your response. That I got it with my query; but I want to add one more column with %Failed_Active. I want to take the percentage with same column &lt;/P&gt;

&lt;P&gt;example: if Activate Failed having the values like ('------' given for separating the fields)&lt;/P&gt;

&lt;P&gt;host -------- Activate Failed             ------ % Failed_Active&lt;BR /&gt;
     A -------------    2                      --------------------------- 33.3 (formula to get this percent is 2/6*100)&lt;BR /&gt;
     B -------------    3                      ---------------------------50.0 (formula to get this percent is 3/6*100)&lt;BR /&gt;
     C -------------    1                      ---------------------------16.7 (formula to get this percent is 1/6*100)&lt;BR /&gt;
     D -------------    0                      --------------------------- 0.0 ( formula to get this percent is 0/6*100)&lt;BR /&gt;
Total -------------   6                     ----------------------------100 (formula to get this percent is 6/6*100)&lt;/P&gt;

&lt;P&gt;There is other columns also with this report, but I am getting all those but I am unable to calculate this percentage.&lt;/P&gt;

&lt;P&gt;Thank you &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:06:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percentage/m-p/177495#M51043</guid>
      <dc:creator>Laya123</dc:creator>
      <dc:date>2020-09-29T07:06:11Z</dc:date>
    </item>
    <item>
      <title>Re: how to calculate percentage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percentage/m-p/177496#M51044</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;use eventstats to add the total number of "Activate Failed" to every event:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count | eval host="A" | eval "Act type"="Activate" | eval STATUS="Failed" | append[| stats count | eval host="B" | eval "Act type"="Publish" | eval STATUS="Success"] | append[| stats count | eval host="A" | eval "Act type"="Activate" | eval STATUS="Failed"] | append[| stats count | eval host="C" | eval "Act type"="Activate" | eval STATUS="Failed"] | append[| stats count | eval host="B" | eval "Act type"="Activate" | eval STATUS="Success"] | append[| stats count | eval host="A" | eval "Act type"="Activate" | eval STATUS="Success"] | append[| stats count | eval host="C" | eval "Act type"="Launch" | eval STATUS="Success"] | append[| stats count | eval host="B" | eval "Act type"="Activate" | eval STATUS="Success"] | table host "Act type" STATUS | stats count by host "Act type" STATUS | eval new_field = 'Act type'." ".'STATUS' | chart max(count) by host new_field | fillnull | addtotals | eval perc_failed = 'Activate Failed' / Total  * 100 | eventstats sum("Activate Failed") as sum_failed | eval "% Failed Active" = 'Activate Failed' / 'sum_failed' * 100 | fields - sum_failed | addcoltotals labelfield=host label="Total" "Activate Failed" "% Failed Active"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Aug 2015 14:23:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percentage/m-p/177496#M51044</guid>
      <dc:creator>tom_frotscher</dc:creator>
      <dc:date>2015-08-21T14:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: how to calculate percentage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percentage/m-p/177497#M51045</link>
      <description>&lt;P&gt;Thank you so much; its working&lt;/P&gt;</description>
      <pubDate>Fri, 21 Aug 2015 15:53:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-calculate-percentage/m-p/177497#M51045</guid>
      <dc:creator>Laya123</dc:creator>
      <dc:date>2015-08-21T15:53:08Z</dc:date>
    </item>
  </channel>
</rss>

