<?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 Percentage in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Stats-Percentage/m-p/546111#M154785</link>
    <description>&lt;P&gt;and because in Splunk you can do the same thing many ways, you can replace the last 3 lines with these two, which gives you the same sort of results.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| top Result_Type by Phone_Number
| where Result_Type=0&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 31 Mar 2021 03:12:16 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2021-03-31T03:12:16Z</dc:date>
    <item>
      <title>Stats Percentage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-Percentage/m-p/546107#M154783</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a data source that lists phone calls.&lt;/P&gt;&lt;P&gt;Each call record will list a set of values, in defined fields&lt;/P&gt;&lt;P&gt;The key information I’m interesting in, is a field called &lt;STRONG&gt;Phone_Number&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;And a field called &lt;STRONG&gt;Result&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;There are about 6 valid values for &lt;STRONG&gt;Result&lt;/STRONG&gt; which I wish to remap as follows&lt;/P&gt;&lt;P&gt;A,B = Good_Result&lt;/P&gt;&lt;P&gt;C,D,E=Bad_Result&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to list the Phone_Numbers based on a count (by percentage of Bad calls)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Phone_Number&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; % Bad_Result&lt;/P&gt;&lt;P&gt;800123455&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 80&lt;/P&gt;&lt;P&gt;800444666&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 77&lt;/P&gt;&lt;P&gt;800781711&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 23&lt;/P&gt;&lt;P&gt;800372728&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&lt;/P&gt;&lt;P&gt;800312711&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;/P&gt;</description>
      <pubDate>Wed, 31 Mar 2021 00:57:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-Percentage/m-p/546107#M154783</guid>
      <dc:creator>c799651</dc:creator>
      <dc:date>2021-03-31T00:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: Stats Percentage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-Percentage/m-p/546110#M154784</link>
      <description>&lt;P&gt;Have a look at this 'run anywhere' example. You can paste this into the search window and run it. It takes your expected bad result % and phone numbers and creates some random data based on your description of ABCDE results.&lt;/P&gt;&lt;P&gt;The last 4 lines of this query are the ones that take the Phone_Number and result data and calculate the percentage. All lines before that are just creating the data set. If you run the query without the 4 lines you can see what the data looks like.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="Phone_Number                Threshold
800123455                           80
800444666                           77
800781711                           23
800372728                           4
800312711                           2"
| multikv forceheader=1
| eval n=mvrange(1,50 + (random() % 100))
| fields - _raw _time linecount
| mvexpand n
| eval Result=if(random() % 100 &amp;gt; Threshold, mvindex(split("A,B",","), random() % 1), mvindex(split("C,D,E",","), random() % 2))
| fields - n Threshold
| eval Result_Type=case(Result IN ("A","B"), 1, Result IN ("C","D", "E"), 0)
| stats sum(eval(if(Result_Type=1, 1, 0))) as "Good Results" sum(eval(if(Result_Type=0, 1, 0))) as "Bad Results" count as "Total Calls" by Phone_Number
| eval "Bad Result %" =  round('Bad Results' / 'Total Calls' * 100)
| table Phone_Number "Total Calls" "Bad Results" "Bad Result %"&lt;/LI-CODE&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Mar 2021 03:09:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-Percentage/m-p/546110#M154784</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2021-03-31T03:09:22Z</dc:date>
    </item>
    <item>
      <title>Re: Stats Percentage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-Percentage/m-p/546111#M154785</link>
      <description>&lt;P&gt;and because in Splunk you can do the same thing many ways, you can replace the last 3 lines with these two, which gives you the same sort of results.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| top Result_Type by Phone_Number
| where Result_Type=0&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Mar 2021 03:12:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-Percentage/m-p/546111#M154785</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2021-03-31T03:12:16Z</dc:date>
    </item>
    <item>
      <title>Re: Stats Percentage</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Stats-Percentage/m-p/546116#M154788</link>
      <description>&lt;P&gt;Thank you. You are indeed a champion!&lt;/P&gt;</description>
      <pubDate>Wed, 31 Mar 2021 04:39:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Stats-Percentage/m-p/546116#M154788</guid>
      <dc:creator>c799651</dc:creator>
      <dc:date>2021-03-31T04:39:08Z</dc:date>
    </item>
  </channel>
</rss>

