<?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: Search not calculating percentages when a join subsearch is being used in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-not-calculating-percentages-when-a-join-subsearch-is/m-p/172581#M49475</link>
    <description>&lt;P&gt;Yup - great call.  Splunk did not like the underscore in the field names.  3 hours of my life I won't get back &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;  Thanks!  Mike&lt;/P&gt;</description>
    <pubDate>Mon, 09 Dec 2013 16:47:50 GMT</pubDate>
    <dc:creator>lehrfeld</dc:creator>
    <dc:date>2013-12-09T16:47:50Z</dc:date>
    <item>
      <title>Search not calculating percentages when a join subsearch is being used</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-not-calculating-percentages-when-a-join-subsearch-is/m-p/172579#M49473</link>
      <description>&lt;P&gt;All - I have what I originally thought was a simple problem.  I needed to calculate a percentage from two values in a row.&lt;/P&gt;

&lt;P&gt;For example, my current output looks like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Repeat Phish Campaign   Total_Emails  E-Mails_clicked    percentage
2                           1000            100            
4                           2000            400
6                           3000            1500
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I can't seem to get the search to calculate the percentage between the total and clicked emails.  Here is the current search that generates the above output.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=phishing_recipients repeat 
| stats count as phishingRcvd by campID 
| join type=outer max=0 campID [search sourcetype=phishing_clickers] 
| stats first(phishingRcvd) as Total_E-mails_Sent, count(userID) as E-Mails_Clicked by campID
| eval percentage = E-Mails_Clicked * 100 / Total_E-mails_Sent
| rename campID as "Repeat Phish Campaign" 
| table "Repeat Phish Campaign", Total_E-mails_Sent, E-Mails_Clicked, percentage
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am raising the white flag on this one...&lt;/P&gt;

&lt;P&gt;Thanks!  Mike&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2013 16:34:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-not-calculating-percentages-when-a-join-subsearch-is/m-p/172579#M49473</guid>
      <dc:creator>lehrfeld</dc:creator>
      <dc:date>2013-12-09T16:34:38Z</dc:date>
    </item>
    <item>
      <title>Re: Search not calculating percentages when a join subsearch is being used</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-not-calculating-percentages-when-a-join-subsearch-is/m-p/172580#M49474</link>
      <description>&lt;P&gt;This should work.&lt;/P&gt;

&lt;P&gt;... | eval perc = email_clicked / total_email * 100&lt;/P&gt;

&lt;P&gt;If you are not getting any results &lt;EM&gt;at all&lt;/EM&gt; for the percentage, I would recommend you to rename your fields, so that they do &lt;STRONG&gt;not&lt;/STRONG&gt; contain hyphens, i.e. &lt;CODE&gt;Total_E_mails_Sent&lt;/CODE&gt; instead of &lt;CODE&gt;Total_E-mails_sent&lt;/CODE&gt; etc..&lt;/P&gt;

&lt;P&gt;/K&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:26:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-not-calculating-percentages-when-a-join-subsearch-is/m-p/172580#M49474</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2020-09-28T15:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: Search not calculating percentages when a join subsearch is being used</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-not-calculating-percentages-when-a-join-subsearch-is/m-p/172581#M49475</link>
      <description>&lt;P&gt;Yup - great call.  Splunk did not like the underscore in the field names.  3 hours of my life I won't get back &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;  Thanks!  Mike&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2013 16:47:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-not-calculating-percentages-when-a-join-subsearch-is/m-p/172581#M49475</guid>
      <dc:creator>lehrfeld</dc:creator>
      <dc:date>2013-12-09T16:47:50Z</dc:date>
    </item>
  </channel>
</rss>

