<?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 search the percentage of values in a field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-percentage-of-values-in-a-field/m-p/286258#M86662</link>
    <description>&lt;P&gt;Can you provide available fields and some sample data from the lookup and expected output?&lt;/P&gt;</description>
    <pubDate>Thu, 02 Jun 2016 16:08:09 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2016-06-02T16:08:09Z</dc:date>
    <item>
      <title>How to search the percentage of values in a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-percentage-of-values-in-a-field/m-p/286257#M86661</link>
      <description>&lt;P&gt;I'm trying build a bar chart from an asset list that shows by bunit what percentage of a field called &lt;STRONG&gt;last&lt;/STRONG&gt; has a value in it.&lt;BR /&gt;
I used &lt;CODE&gt;isnotnull&lt;/CODE&gt; to create a field with yes/no values, but I'm not sure how to show the percentage.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup my_assets.csv | eval percentage=if(isnotnull(last),"yes","no") 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Jun 2016 15:54:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-percentage-of-values-in-a-field/m-p/286257#M86661</guid>
      <dc:creator>jsmith_splunk</dc:creator>
      <dc:date>2016-06-02T15:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to search the percentage of values in a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-percentage-of-values-in-a-field/m-p/286258#M86662</link>
      <description>&lt;P&gt;Can you provide available fields and some sample data from the lookup and expected output?&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2016 16:08:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-percentage-of-values-in-a-field/m-p/286258#M86662</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-06-02T16:08:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to search the percentage of values in a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-percentage-of-values-in-a-field/m-p/286259#M86663</link>
      <description>&lt;P&gt;dns, nt_host, ip, owner, bunit, category, last&lt;BR /&gt;
servera.mydomain.com,servera,1.1.1.1,Mark,groupa,linux,6/1/2016 12:08:34&lt;BR /&gt;
serverb.mydomain.com,serverb,1.1.12,Brian,groupb,windows,,&lt;/P&gt;

&lt;P&gt;I can't tell if I'm on the right track or not, I've built the query out to this, but I'm not getting a return for the field count&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup my_assets.csv | eval hasvalue=if(isnotnull(last),"yes","no") | stats sum(hasvalue=yes) as count by bunit | eventstats sum(hasvalue=no) as total | eval percent = round(count/total,2)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Jun 2016 16:22:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-percentage-of-values-in-a-field/m-p/286259#M86663</guid>
      <dc:creator>jsmith_splunk</dc:creator>
      <dc:date>2016-06-02T16:22:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to search the percentage of values in a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-percentage-of-values-in-a-field/m-p/286260#M86664</link>
      <description>&lt;P&gt;You're in right direction. Try like this (using just the count will give total number of rows and count(field) will give count where field has a value)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | inputlookup my_assets.csv | stats count as total count(last) as count by bunit | eval percent = round(count/total,2)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Jun 2016 16:31:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-percentage-of-values-in-a-field/m-p/286260#M86664</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-06-02T16:31:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to search the percentage of values in a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-percentage-of-values-in-a-field/m-p/286261#M86665</link>
      <description>&lt;P&gt;That was much easier than the direction I was going.&lt;BR /&gt;
Thank you very much!&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2016 16:57:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-percentage-of-values-in-a-field/m-p/286261#M86665</guid>
      <dc:creator>jsmith_splunk</dc:creator>
      <dc:date>2016-06-02T16:57:20Z</dc:date>
    </item>
  </channel>
</rss>

