<?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: Comparing data from 2 days by data type in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-2-days-by-data-type/m-p/636259#M220965</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Thank you for the query. You are right,&amp;nbsp;&lt;SPAN&gt;it's better to count two days ago with yesterday and compare the results for&amp;nbsp;two full days.&amp;nbsp; Could you please guide the query for this?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I tried the query you provided but I got the same count for "today" and "yesterday", not sure why.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Min1025_1-1679991124350.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/24573i00D066EF5FB57CEB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Min1025_1-1679991124350.png" alt="Min1025_1-1679991124350.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Min&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Mar 2023 08:17:16 GMT</pubDate>
    <dc:creator>Min1025</dc:creator>
    <dc:date>2023-03-28T08:17:16Z</dc:date>
    <item>
      <title>Comparing data from 2 days by data type?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-2-days-by-data-type/m-p/636087#M220946</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;I want to compare the data from 2 days by data type, my expected result is as below, is it possible?&lt;/P&gt;
&lt;TABLE width="620"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="73"&gt;Data Type&lt;/TD&gt;
&lt;TD width="119"&gt;Yesterday&lt;/TD&gt;
&lt;TD width="124"&gt;Yesterday Count&lt;/TD&gt;
&lt;TD width="76"&gt;Today&lt;/TD&gt;
&lt;TD width="91"&gt;Today Count&lt;/TD&gt;
&lt;TD width="137"&gt;Count Change Rate&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;A&lt;/TD&gt;
&lt;TD&gt;2023/3/26&lt;/TD&gt;
&lt;TD&gt;15&lt;/TD&gt;
&lt;TD&gt;2023/3/27&lt;/TD&gt;
&lt;TD&gt;18&lt;/TD&gt;
&lt;TD&gt;0.20&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;B&lt;/TD&gt;
&lt;TD&gt;2023/3/26&lt;/TD&gt;
&lt;TD&gt;20&lt;/TD&gt;
&lt;TD&gt;2023/3/27&lt;/TD&gt;
&lt;TD&gt;19&lt;/TD&gt;
&lt;TD&gt;-0.05&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;C&lt;/TD&gt;
&lt;TD&gt;2023/3/26&lt;/TD&gt;
&lt;TD&gt;16&lt;/TD&gt;
&lt;TD&gt;2023/3/27&lt;/TD&gt;
&lt;TD&gt;35&lt;/TD&gt;
&lt;TD&gt;1.19&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;D&lt;/TD&gt;
&lt;TD&gt;2023/3/26&lt;/TD&gt;
&lt;TD&gt;21&lt;/TD&gt;
&lt;TD&gt;2023/3/27&lt;/TD&gt;
&lt;TD&gt;40&lt;/TD&gt;
&lt;TD&gt;0.90&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;E&lt;/TD&gt;
&lt;TD&gt;2023/3/26&lt;/TD&gt;
&lt;TD&gt;30&lt;/TD&gt;
&lt;TD&gt;2023/3/27&lt;/TD&gt;
&lt;TD&gt;25&lt;/TD&gt;
&lt;TD&gt;-0.17&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;F&lt;/TD&gt;
&lt;TD&gt;2023/3/26&lt;/TD&gt;
&lt;TD&gt;40&lt;/TD&gt;
&lt;TD&gt;2023/3/27&lt;/TD&gt;
&lt;TD&gt;50&lt;/TD&gt;
&lt;TD&gt;0.25&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Mon, 27 Mar 2023 14:17:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-2-days-by-data-type/m-p/636087#M220946</guid>
      <dc:creator>Min1025</dc:creator>
      <dc:date>2023-03-27T14:17:09Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing data from 2 days by data type</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-2-days-by-data-type/m-p/636094#M220947</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/104438"&gt;@Min1025&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;there's a thing that I don't understand: todays count will always be less than yesterdat count because today is in progress, maybe it could be better to count two days ago with yesterday, to have two full days to compare, anyway,&amp;nbsp;please try something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_search&amp;gt; earliest=-d@d latest=
| eval day=strftime(_time,"%Y-%m-%d"), today=strftime(now(),"%Y-%m-%d")
| stats 
   values(eval(if(day!=today,day,"") AS "Yesterday" 
   count(eval(if(day!=today,1,0)))  AS "Yesterday Count"
   values(eval(if(day=today,day,"") AS "Today" 
   count(eval(if(day=today,1,0)))  AS "Today Count"
   BY "Data Type"
| eval "Count Change Rate"=round(1-"Yesterday Count"/"Today Count",2)&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 06:54:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-2-days-by-data-type/m-p/636094#M220947</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-03-27T06:54:58Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing data from 2 days by data type</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-2-days-by-data-type/m-p/636259#M220965</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Thank you for the query. You are right,&amp;nbsp;&lt;SPAN&gt;it's better to count two days ago with yesterday and compare the results for&amp;nbsp;two full days.&amp;nbsp; Could you please guide the query for this?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I tried the query you provided but I got the same count for "today" and "yesterday", not sure why.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Min1025_1-1679991124350.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/24573i00D066EF5FB57CEB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Min1025_1-1679991124350.png" alt="Min1025_1-1679991124350.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Min&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 08:17:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-2-days-by-data-type/m-p/636259#M220965</guid>
      <dc:creator>Min1025</dc:creator>
      <dc:date>2023-03-28T08:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing data from 2 days by data type</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-2-days-by-data-type/m-p/636262#M220967</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/104438"&gt;@Min1025&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;ok, in this case, you have only to modify the time period and something else, please try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_search&amp;gt; earliest=-2d@d latest=@d
| eval 
   day=strftime(_time,"%Y-%m-%d")
   previous_day=if(now()-_time&amp;lt;86400,day,"")
   yesterday=if(now()-_time&amp;gt;86400,day,"")
| stats 
   values(previous_day) AS "Previous day" 
   count(eval(if(day=previous_day,1,0))) AS "Previous day Count"
   max(yesterday) AS "Yesterday" 
   count(eval(if(day=yesterday,1,0))) AS "Yesterday Count"
   BY "Data Type"
| eval "Count Change Rate"=round(1-"Previous day Count"/"Yesterday Count",2)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 08:36:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-2-days-by-data-type/m-p/636262#M220967</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-03-28T08:36:52Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing data from 2 days by data type?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-2-days-by-data-type/m-p/636672#M221110</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Thank you for the query. I tried this query and encountered 2 issues.&lt;/P&gt;&lt;P&gt;1. The previous date returned both previous day and yesterday.&lt;/P&gt;&lt;P&gt;2. The previous count is same as yesterday count.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Min1025_0-1680172230135.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/24632iE33CCCAE1C783C0C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Min1025_0-1680172230135.png" alt="Min1025_0-1680172230135.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Do you have any idea for above issues?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Min&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2023 10:31:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-2-days-by-data-type/m-p/636672#M221110</guid>
      <dc:creator>Min1025</dc:creator>
      <dc:date>2023-03-30T10:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing data from 2 days by data type?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-2-days-by-data-type/m-p/636685#M221114</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/104438"&gt;@Min1025&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;please try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_search&amp;gt; earliest=-2d@d latest=@d
| eval 
   day=strftime(_time,"%Y-%m-%d"),
   yesterday=strftime(now()-86400,"%Y-%m-%d"),
   previous_day=strftime(now()-172800,"%Y-%m-%d")
| stats 
   values(previous_day) AS "Previous day" 
   count(eval(if(day=previous_day,1,0))) AS "Previous day Count"
   values(yesterday) AS "Yesterday" 
   count(eval(if(day=yesterday,1,0))) AS "Yesterday Count"
   BY "Data Type"
| eval "Count Change Rate"=round(1-"Previous day Count"/"Yesterday Count",2)&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2023 11:13:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-data-from-2-days-by-data-type/m-p/636685#M221114</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-03-30T11:13:21Z</dc:date>
    </item>
  </channel>
</rss>

