<?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: Find the percentage between two fields from two sourcetypes in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Find-the-percentage-between-two-fields-from-two-sourcetypes/m-p/115614#M183869</link>
    <description>&lt;P&gt;what about starting with something like that, then calculate the ratio. &lt;BR /&gt;
&lt;CODE&gt;sourcetype=submitters OR sourcetype=recipient_group | chart dc(UserID) by UserID sourcetype | eval in_both=if(submitters==1 AND recipient_group==1,1,0)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Then do the total and clean, then eval a percentage&lt;BR /&gt;
&lt;CODE&gt;... | addcoltotals |  WHERE isnull(UserID) | table submitters recipient_group in_both&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 25 Oct 2013 17:20:14 GMT</pubDate>
    <dc:creator>yannK</dc:creator>
    <dc:date>2013-10-25T17:20:14Z</dc:date>
    <item>
      <title>Find the percentage between two fields from two sourcetypes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-the-percentage-between-two-fields-from-two-sourcetypes/m-p/115613#M183868</link>
      <description>&lt;P&gt;I have two sourcetypes - &lt;STRONG&gt;submitters&lt;/STRONG&gt;, and &lt;STRONG&gt;recipient_group&lt;/STRONG&gt;.  I am looking to find the percentage of submitters that are in the recipient_group.  If I have 500 submitters and 1000 recipients, my percentage would be 50%.  The following search gives me the dc of users in each sourcetype, but I don't have the Splunk knowledge on how to retain those values so I can perform the math.  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype = submitters OR sourcetype=recipient_group  | eval UserID{sourcetype}=UserID | stats dc(UserIDR*), dc(UserIDS*)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks everyone!  Mike&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2013 16:47:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-the-percentage-between-two-fields-from-two-sourcetypes/m-p/115613#M183868</guid>
      <dc:creator>lehrfeld</dc:creator>
      <dc:date>2013-10-25T16:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: Find the percentage between two fields from two sourcetypes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-the-percentage-between-two-fields-from-two-sourcetypes/m-p/115614#M183869</link>
      <description>&lt;P&gt;what about starting with something like that, then calculate the ratio. &lt;BR /&gt;
&lt;CODE&gt;sourcetype=submitters OR sourcetype=recipient_group | chart dc(UserID) by UserID sourcetype | eval in_both=if(submitters==1 AND recipient_group==1,1,0)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Then do the total and clean, then eval a percentage&lt;BR /&gt;
&lt;CODE&gt;... | addcoltotals |  WHERE isnull(UserID) | table submitters recipient_group in_both&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2013 17:20:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-the-percentage-between-two-fields-from-two-sourcetypes/m-p/115614#M183869</guid>
      <dc:creator>yannK</dc:creator>
      <dc:date>2013-10-25T17:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: Find the percentage between two fields from two sourcetypes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-the-percentage-between-two-fields-from-two-sourcetypes/m-p/115615#M183870</link>
      <description>&lt;P&gt;yannK - Thanks for the response.  To keep it simple, both of our sourcetypes only have one type of data in it.  So a simple dc(userID) will give use the count needed to calculate the ratio.  I just can't find a way to capture those values to do a calculation on them.  I will keep tweaking the code and post back soon (hopefully).  Mike&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2013 17:55:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-the-percentage-between-two-fields-from-two-sourcetypes/m-p/115615#M183870</guid>
      <dc:creator>lehrfeld</dc:creator>
      <dc:date>2013-10-25T17:55:42Z</dc:date>
    </item>
    <item>
      <title>Re: Find the percentage between two fields from two sourcetypes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-the-percentage-between-two-fields-from-two-sourcetypes/m-p/115616#M183871</link>
      <description>&lt;P&gt;Figured it out.  My issue was using the wildcard '*' in the dc command.  When I used the entire name - poof!&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;sourcetype = submitters OR&lt;BR /&gt;
sourcetype=recipient_group  | eval&lt;BR /&gt;
UserID{sourcetype}=UserID |stats&lt;BR /&gt;
dc(eval(UserIDRecipient_Group)) as&lt;BR /&gt;
USERR, dc(eval(UserIDSubmitters)) as&lt;BR /&gt;
USERS | eval&lt;BR /&gt;
percentage=(USERS/USERR*100)&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:05:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-the-percentage-between-two-fields-from-two-sourcetypes/m-p/115616#M183871</guid>
      <dc:creator>lehrfeld</dc:creator>
      <dc:date>2020-09-28T15:05:33Z</dc:date>
    </item>
  </channel>
</rss>

