<?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: calculate Field count and pass it for percent calculation in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/calculate-Field-count-and-pass-it-for-percent-calculation/m-p/245508#M176483</link>
    <description>&lt;P&gt;There are a couple of ways you can do this.. You almost has both of them.. Try one of these&lt;/P&gt;

&lt;P&gt;Using &lt;CODE&gt;eventstats&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="charm_normal_index"|eventstats count as Total_events | where (reformat_time &amp;gt;= now_time) AND ('System Status'!="Completed") | eval reformat_time= strftime(strptime('Due By',"%d.%m.%Y"),"%d.%m.%Y") | eval now_time=strftime(now(),"%d.%m.%Y") | stats count as Missed_count values(Total_events) as Total_events 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Using &lt;CODE&gt;stats&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="charm_normal_index"|eventstats count as Total_events | eval reformat_time= strftime(strptime('Due By',"%d.%m.%Y"),"%d.%m.%Y") | eval now_time=strftime(now(),"%d.%m.%Y") | stats count as Total_events count(eval((reformat_time &amp;gt;= now_time) AND ('System Status'!="Completed") )) as Missed_count 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 13 Oct 2016 11:47:33 GMT</pubDate>
    <dc:creator>sundareshr</dc:creator>
    <dc:date>2016-10-13T11:47:33Z</dc:date>
    <item>
      <title>calculate Field count and pass it for percent calculation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/calculate-Field-count-and-pass-it-for-percent-calculation/m-p/245507#M176482</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
I'm a newbie to splunk. Struggling with a query. All i want to do now is pass the total value so that i can calculate the %. One part of query is done. Other part I'm facing issue - to pass total value&lt;BR /&gt;
Tried this&lt;BR /&gt;
1. index="my_index" | eval reformat_time= strftime(strptime('Due Date',"%d.%m.%Y"),"%d.%m.%Y")|eval now_time=strftime(now(),"%d.%m.%Y")|where (reformat_time &amp;gt;= now_time) AND ('Status'!="Oxxx") |stats count as Missed_count &lt;STRONG&gt;count(eval(index=” my_index”) as Total&lt;/STRONG&gt;|table  Missed_count  Total .. I'm not able to get total and hence could not calculate completed %. I got missed count. Im looking for total count to calculate %. &lt;BR /&gt;
2. Tried with eventstats too&lt;BR /&gt;
index="charm_normal_index"|eventstats count as Total_events|eval reformat_time= strftime(strptime('Due By',"%d.%m.%Y"),"%d.%m.%Y")|eval now_time=strftime(now(),"%d.%m.%Y")|where (reformat_time &amp;gt;= now_time) AND ('System Status'!="Completed") |stats count as Missed_count| table Missed_count Total_events&lt;/P&gt;

&lt;P&gt;No luck. Please help&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:22:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/calculate-Field-count-and-pass-it-for-percent-calculation/m-p/245507#M176482</guid>
      <dc:creator>k_harini</dc:creator>
      <dc:date>2020-09-29T11:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: calculate Field count and pass it for percent calculation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/calculate-Field-count-and-pass-it-for-percent-calculation/m-p/245508#M176483</link>
      <description>&lt;P&gt;There are a couple of ways you can do this.. You almost has both of them.. Try one of these&lt;/P&gt;

&lt;P&gt;Using &lt;CODE&gt;eventstats&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="charm_normal_index"|eventstats count as Total_events | where (reformat_time &amp;gt;= now_time) AND ('System Status'!="Completed") | eval reformat_time= strftime(strptime('Due By',"%d.%m.%Y"),"%d.%m.%Y") | eval now_time=strftime(now(),"%d.%m.%Y") | stats count as Missed_count values(Total_events) as Total_events 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Using &lt;CODE&gt;stats&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="charm_normal_index"|eventstats count as Total_events | eval reformat_time= strftime(strptime('Due By',"%d.%m.%Y"),"%d.%m.%Y") | eval now_time=strftime(now(),"%d.%m.%Y") | stats count as Total_events count(eval((reformat_time &amp;gt;= now_time) AND ('System Status'!="Completed") )) as Missed_count 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Oct 2016 11:47:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/calculate-Field-count-and-pass-it-for-percent-calculation/m-p/245508#M176483</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-10-13T11:47:33Z</dc:date>
    </item>
    <item>
      <title>Re: calculate Field count and pass it for percent calculation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/calculate-Field-count-and-pass-it-for-percent-calculation/m-p/245509#M176484</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Using stats worked. 1st query did not work. There is another option with join. I did with that. Thanks a lot for your response&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2016 17:45:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/calculate-Field-count-and-pass-it-for-percent-calculation/m-p/245509#M176484</guid>
      <dc:creator>k_harini</dc:creator>
      <dc:date>2016-10-13T17:45:04Z</dc:date>
    </item>
  </channel>
</rss>

