<?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: Two stats on different period in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Two-stats-on-different-period/m-p/497783#M138649</link>
    <description>&lt;P&gt;@to4kawa  my expected result is : &lt;BR /&gt;
client : 35535&lt;BR /&gt;
Recieved : 1&lt;BR /&gt;
answered : 1&lt;BR /&gt;
deleted : 0&lt;BR /&gt;
knowing that the research period is from 09/12 to 10/12,but because my client answered between 09 and 14 I display 1 in answered&lt;/P&gt;</description>
    <pubDate>Thu, 30 Jan 2020 08:23:27 GMT</pubDate>
    <dc:creator>tahasefiani</dc:creator>
    <dc:date>2020-01-30T08:23:27Z</dc:date>
    <item>
      <title>Two stats on different period</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Two-stats-on-different-period/m-p/497779#M138645</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;
I have this query that return me the table below.&lt;/P&gt;

&lt;P&gt;The query : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    | loadjob savedsearch="myquery"
          | where (strftime(_time, "%Y-%m-%d") &amp;gt;= "2019-12-09") AND (strftime(_time, "%Y-%m-%d") &amp;lt;= "2019-12-10")
          | stats dc(eval(if(((STEP=="Recieved",ID_MESSAGE,NULL))) AS Recieved,
                    dc(eval(if(((STEP=="answered",ID_MESSAGE,NULL))) AS answered,
                    dc(eval(if(((STEP=="deleted",ID_MESSAGE,NULL))) AS deleted by client
|fields client,Recieved,answered,deleted
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Result :&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/8302iA34A85152FDFAAEC/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;The problem is , for some client like "35535" he receieved the Message 10/12 but he answered the 12/12, i want to give my client a margin of 4 days.&lt;BR /&gt;
So,if my client recieves the message between the 09/12 and 10/12, i will check if his answered between the 09/10 and the 14/12.&lt;BR /&gt;
the messages received and deleted must be over the period from 09/12 and 10/10, but those answered must be from 09/12 and 14/12&lt;BR /&gt;
Thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 16:10:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Two-stats-on-different-period/m-p/497779#M138645</guid>
      <dc:creator>tahasefiani</dc:creator>
      <dc:date>2020-01-29T16:10:17Z</dc:date>
    </item>
    <item>
      <title>Re: Two stats on different period</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Two-stats-on-different-period/m-p/497780#M138646</link>
      <description>&lt;P&gt;what's your expected result?&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2020 01:20:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Two-stats-on-different-period/m-p/497780#M138646</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-30T01:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: Two stats on different period</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Two-stats-on-different-period/m-p/497781#M138647</link>
      <description>&lt;P&gt;Not an answer but just wanted to point out that this portion &lt;CODE&gt;| where (strftime(_time, "%Y-%m-%d") &amp;gt;= "2019-12-09") AND (strftime(_time, "%Y-%m-%d") &amp;lt;= "2019-12-10")&lt;/CODE&gt; might not work as expected. It's better to make comparison operation like greater than if the time is in epoch, rather than formatted in string. maybe consider doing &lt;CODE&gt;|where _time &amp;gt;= strptime("2019-12-09", "%F") AND _time &amp;lt;= strptime("2019-12-10", "%F")&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2020 01:55:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Two-stats-on-different-period/m-p/497781#M138647</guid>
      <dc:creator>morethanyell</dc:creator>
      <dc:date>2020-01-30T01:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: Two stats on different period</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Two-stats-on-different-period/m-p/497782#M138648</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval check=if(strftime(now(),"%F") &amp;lt; strftime(relative_time(now(),"+1d@d"),"%F"), "OK" ,"NG")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I think so ,too. but Splunk can....&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2020 03:52:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Two-stats-on-different-period/m-p/497782#M138648</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-30T03:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: Two stats on different period</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Two-stats-on-different-period/m-p/497783#M138649</link>
      <description>&lt;P&gt;@to4kawa  my expected result is : &lt;BR /&gt;
client : 35535&lt;BR /&gt;
Recieved : 1&lt;BR /&gt;
answered : 1&lt;BR /&gt;
deleted : 0&lt;BR /&gt;
knowing that the research period is from 09/12 to 10/12,but because my client answered between 09 and 14 I display 1 in answered&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2020 08:23:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Two-stats-on-different-period/m-p/497783#M138649</guid>
      <dc:creator>tahasefiani</dc:creator>
      <dc:date>2020-01-30T08:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: Two stats on different period</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Two-stats-on-different-period/m-p/497784#M138650</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| loadjob savedsearch="myquery" 
| stats dc(eval(if(STEP=="Recieved" AND (strftime(_time, "%Y-%m-%d") &amp;gt;= "2019-12-09" AND strftime(_time, "%Y-%m-%d") &amp;lt;= "2019-12-10"),ID_MESSAGE,NULL))) AS Recieved,
    dc(eval(if(STEP=="answered" AND (strftime(_time, "%Y-%m-%d") &amp;gt;= "2019-12-09" AND strftime(_time, "%Y-%m-%d") &amp;lt;= "2019-12-14",ID_MESSAGE,NULL))) AS answered,
    dc(eval(if(STEP=="deleted" AND (strftime(_time, "%Y-%m-%d") &amp;gt;= "2019-12-09" AND strftime(_time, "%Y-%m-%d") &amp;lt;= "2019-12-10"),ID_MESSAGE,NULL))) AS deleted by client 
| fields client,Recieved,answered,deleted
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Be careful &lt;EM&gt;time picker&lt;/EM&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2020 08:43:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Two-stats-on-different-period/m-p/497784#M138650</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-30T08:43:33Z</dc:date>
    </item>
  </channel>
</rss>

