<?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 Get percentage after case and stats calculations in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Get-percentage-after-case-and-stats-calculations/m-p/376339#M169582</link>
    <description>&lt;P&gt;...search&lt;BR /&gt;
| eval Type=case(like(publishId,"%U"),"UnSubscribed",like(publishId,"%S"),"Subscribed") &lt;BR /&gt;
| stats dc(accountExId) as TotalAccounts count(tile) as count by Type &lt;/P&gt;

&lt;P&gt;How do I get a percentage after the above results?&lt;BR /&gt;
If Subscribed:   eval round(count/TotalAccounts*100,2)&lt;BR /&gt;
If UnSubscribed:  eval round(count/totalAccounts*100,2)&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 19:22:24 GMT</pubDate>
    <dc:creator>dwong2</dc:creator>
    <dc:date>2020-09-29T19:22:24Z</dc:date>
    <item>
      <title>Get percentage after case and stats calculations</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-percentage-after-case-and-stats-calculations/m-p/376339#M169582</link>
      <description>&lt;P&gt;...search&lt;BR /&gt;
| eval Type=case(like(publishId,"%U"),"UnSubscribed",like(publishId,"%S"),"Subscribed") &lt;BR /&gt;
| stats dc(accountExId) as TotalAccounts count(tile) as count by Type &lt;/P&gt;

&lt;P&gt;How do I get a percentage after the above results?&lt;BR /&gt;
If Subscribed:   eval round(count/TotalAccounts*100,2)&lt;BR /&gt;
If UnSubscribed:  eval round(count/totalAccounts*100,2)&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:22:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-percentage-after-case-and-stats-calculations/m-p/376339#M169582</guid>
      <dc:creator>dwong2</dc:creator>
      <dc:date>2020-09-29T19:22:24Z</dc:date>
    </item>
    <item>
      <title>Re: Get percentage after case and stats calculations</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-percentage-after-case-and-stats-calculations/m-p/376340#M169583</link>
      <description>&lt;P&gt;Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...search
| eval Type=case(like(publishId,"%U"),"UnSubscribed",like(publishId,"%S"),"Subscribed") 
| stats dc(accountExId) as TotalAccounts count(tile) as count by Type
| eval Percentage=round(count/TotalAccounts*100,2)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 07 May 2018 18:52:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-percentage-after-case-and-stats-calculations/m-p/376340#M169583</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-05-07T18:52:26Z</dc:date>
    </item>
    <item>
      <title>Re: Get percentage after case and stats calculations</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-percentage-after-case-and-stats-calculations/m-p/376341#M169584</link>
      <description>&lt;P&gt;Didn't know that the eval Percentage would calculate for both Subscribed and UnSubscribed with one statement.  Thought that I would have to explicitly call it out.  Anyways, works like a charm.  Thank You!&lt;/P&gt;</description>
      <pubDate>Mon, 07 May 2018 20:31:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-percentage-after-case-and-stats-calculations/m-p/376341#M169584</guid>
      <dc:creator>dwong2</dc:creator>
      <dc:date>2018-05-07T20:31:19Z</dc:date>
    </item>
    <item>
      <title>Re: Get percentage after case and stats calculations</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-percentage-after-case-and-stats-calculations/m-p/376342#M169585</link>
      <description>&lt;P&gt;Yes.. with stats command, both values are coming under single field 'Type', so single eval (which is done for each row) is sufficient.&lt;/P&gt;</description>
      <pubDate>Mon, 07 May 2018 20:37:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-percentage-after-case-and-stats-calculations/m-p/376342#M169585</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-05-07T20:37:21Z</dc:date>
    </item>
    <item>
      <title>Re: Get percentage after case and stats calculations</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Get-percentage-after-case-and-stats-calculations/m-p/376343#M169586</link>
      <description>&lt;P&gt;Just checked the calculations and something is off with my calc's..&lt;BR /&gt;
For the count(tile) as count by Type:&lt;BR /&gt;
...this is the data:&lt;BR /&gt;
accountId=12345678&lt;BR /&gt;
tile=tile1&lt;/P&gt;

&lt;P&gt;accountId=87654321&lt;BR /&gt;
tile=tile2&lt;/P&gt;

&lt;P&gt;accountId=12345678&lt;BR /&gt;
tile=tile3&lt;/P&gt;

&lt;P&gt;How can I get the distinct count for accountId?  For the above example, I only want to count accountId twice because all I care about is if the accountId has at least one entry for tile... so the count should be only 2.&lt;/P&gt;</description>
      <pubDate>Mon, 07 May 2018 21:59:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Get-percentage-after-case-and-stats-calculations/m-p/376343#M169586</guid>
      <dc:creator>dwong2</dc:creator>
      <dc:date>2018-05-07T21:59:19Z</dc:date>
    </item>
  </channel>
</rss>

