<?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 How to count data from different time and use it in the same chart? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-data-from-different-time-and-use-it-in-the-same/m-p/504308#M140775</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;Can someone help me on this problem?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm working on a dashboard that I need to show how many users logged into the system and I need to have 2 views for each 30 minutes:&lt;BR /&gt;&lt;BR /&gt;1. Today&lt;BR /&gt;2. Over time&lt;/P&gt;
&lt;P&gt;(just to have the view if today we are getting more users logged on in history)&lt;BR /&gt;&lt;BR /&gt;I can search it using earliest and latest function for each one, but I dont know how to join them for the same time.&lt;/P&gt;
&lt;P&gt;Here is an example:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;my-search logon-action earliest=1 latest=now()
| fields _time
| bucket span=30min _time
| eval hour=strftime(_time, "%H:%M")
| chart count as "Over-time" over hour&lt;/LI-CODE&gt;
&lt;P&gt;Statistics came like this:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;Hour&lt;/TD&gt;
&lt;TD width="50%"&gt;Count&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;01:00&lt;/TD&gt;
&lt;TD width="50%"&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;01:30&lt;/TD&gt;
&lt;TD width="50%"&gt;10&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;02:00&lt;/TD&gt;
&lt;TD width="50%"&gt;5&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;03:00&lt;/TD&gt;
&lt;TD&gt;8&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;05:00&lt;/TD&gt;
&lt;TD width="50%"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;my-search logon-action earliest=-1@d latest=now()&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| fields _time
| bucket span=30min _time
| eval hour=strftime(_time, "%H:%M")
| chart count as "today" over hour&lt;/LI-CODE&gt;
&lt;P&gt;Statistics came like this:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;hour&lt;/TD&gt;
&lt;TD width="50%"&gt;count&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;01:30&lt;/TD&gt;
&lt;TD width="50%"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;03:00&lt;/TD&gt;
&lt;TD width="50%"&gt;8&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm using the "append" command to have 1 result of the count per 30 min to chart it:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;search logon-action earliest=1 latest=now()
| fields _time
| bucket span=30min _time
| eval hour=strftime(_time, "%H:%M")
| chart count as "Over-time" over hour
| appendcols [
| my-serach search logon-action earliest=-1@d latest=now()
| fields _time
| bucket span=30min _time
| eval hour=strftime(_time, "%H:%M")
| chart count as "today" over hour&lt;/LI-CODE&gt;
&lt;P&gt;and I'm having this:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;hour&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;over time&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;today&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="25px"&gt;01:00&lt;/TD&gt;
&lt;TD height="25px"&gt;4&lt;/TD&gt;
&lt;TD height="25px"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;01:30&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;10&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;8&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;02:00&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;5&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;03:00&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;8&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;05:00&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;1&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, the number 1 and 8 of "Today" is in the line of 01:00h and 01:30, but they actualy belongs to 01:30 and 03:00h&lt;/P&gt;
&lt;P&gt;How can I fix it?&amp;nbsp;I dont know how to do it and I appreciate if you guys can help me to have something like this:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;hour&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;over time&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;today&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="25px"&gt;01:00&lt;/TD&gt;
&lt;TD height="25px"&gt;4&lt;/TD&gt;
&lt;TD height="25px"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;01:30&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;10&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;02:00&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;5&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;03:00&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;8&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;8&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;05:00&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;1&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;any other idea is welcome to fix it&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;</description>
    <pubDate>Mon, 15 Jun 2020 19:22:07 GMT</pubDate>
    <dc:creator>Batidou</dc:creator>
    <dc:date>2020-06-15T19:22:07Z</dc:date>
    <item>
      <title>How to count data from different time and use it in the same chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-data-from-different-time-and-use-it-in-the-same/m-p/504308#M140775</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;Can someone help me on this problem?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm working on a dashboard that I need to show how many users logged into the system and I need to have 2 views for each 30 minutes:&lt;BR /&gt;&lt;BR /&gt;1. Today&lt;BR /&gt;2. Over time&lt;/P&gt;
&lt;P&gt;(just to have the view if today we are getting more users logged on in history)&lt;BR /&gt;&lt;BR /&gt;I can search it using earliest and latest function for each one, but I dont know how to join them for the same time.&lt;/P&gt;
&lt;P&gt;Here is an example:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;my-search logon-action earliest=1 latest=now()
| fields _time
| bucket span=30min _time
| eval hour=strftime(_time, "%H:%M")
| chart count as "Over-time" over hour&lt;/LI-CODE&gt;
&lt;P&gt;Statistics came like this:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;Hour&lt;/TD&gt;
&lt;TD width="50%"&gt;Count&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;01:00&lt;/TD&gt;
&lt;TD width="50%"&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;01:30&lt;/TD&gt;
&lt;TD width="50%"&gt;10&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;02:00&lt;/TD&gt;
&lt;TD width="50%"&gt;5&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;03:00&lt;/TD&gt;
&lt;TD&gt;8&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;05:00&lt;/TD&gt;
&lt;TD width="50%"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;my-search logon-action earliest=-1@d latest=now()&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| fields _time
| bucket span=30min _time
| eval hour=strftime(_time, "%H:%M")
| chart count as "today" over hour&lt;/LI-CODE&gt;
&lt;P&gt;Statistics came like this:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;hour&lt;/TD&gt;
&lt;TD width="50%"&gt;count&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;01:30&lt;/TD&gt;
&lt;TD width="50%"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;03:00&lt;/TD&gt;
&lt;TD width="50%"&gt;8&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm using the "append" command to have 1 result of the count per 30 min to chart it:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;search logon-action earliest=1 latest=now()
| fields _time
| bucket span=30min _time
| eval hour=strftime(_time, "%H:%M")
| chart count as "Over-time" over hour
| appendcols [
| my-serach search logon-action earliest=-1@d latest=now()
| fields _time
| bucket span=30min _time
| eval hour=strftime(_time, "%H:%M")
| chart count as "today" over hour&lt;/LI-CODE&gt;
&lt;P&gt;and I'm having this:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;hour&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;over time&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;today&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="25px"&gt;01:00&lt;/TD&gt;
&lt;TD height="25px"&gt;4&lt;/TD&gt;
&lt;TD height="25px"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;01:30&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;10&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;8&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;02:00&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;5&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;03:00&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;8&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;05:00&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;1&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, the number 1 and 8 of "Today" is in the line of 01:00h and 01:30, but they actualy belongs to 01:30 and 03:00h&lt;/P&gt;
&lt;P&gt;How can I fix it?&amp;nbsp;I dont know how to do it and I appreciate if you guys can help me to have something like this:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;hour&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;over time&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;today&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD height="25px"&gt;01:00&lt;/TD&gt;
&lt;TD height="25px"&gt;4&lt;/TD&gt;
&lt;TD height="25px"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;01:30&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;10&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;02:00&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;5&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;03:00&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;8&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;8&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;05:00&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;1&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;any other idea is welcome to fix it&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2020 19:22:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-data-from-different-time-and-use-it-in-the-same/m-p/504308#M140775</guid>
      <dc:creator>Batidou</dc:creator>
      <dc:date>2020-06-15T19:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to count data from different time and use it in the same chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-data-from-different-time-and-use-it-in-the-same/m-p/504309#M140776</link>
      <description>&lt;P&gt;sample:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats count where index=_internal earliest=1 by _time span=30min
| eval status="OverTime"
| append [|tstats count where index=_internal earliest=-1d@d by _time span=30min | eval status="Today"]
| eval _time=strftime(_time,"%T")
| stats avg(count)  as count by _time status
| xyseries _time status count
| fillnull OverTime Today&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why don't you try &lt;STRONG&gt;&lt;EM&gt;append&amp;nbsp;&lt;/EM&gt;&lt;/STRONG&gt;?&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jun 2020 12:08:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-data-from-different-time-and-use-it-in-the-same/m-p/504309#M140776</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-06-14T12:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to count data from different time and use it in the same chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-data-from-different-time-and-use-it-in-the-same/m-p/504473#M140814</link>
      <description>&lt;P&gt;The culprit for that is &lt;STRONG&gt;appendcols&lt;/STRONG&gt;.&amp;nbsp; It is almost never the right tool for&amp;nbsp; the job, because it does not even try to line up the results, it just puts the first result from the second side onto the first result on the first side, and so on.&amp;nbsp;&lt;/P&gt;&lt;P&gt;When you are connecting two different kinds of data by a key (like the time) you should use &lt;STRONG&gt;append&lt;/STRONG&gt; instead, then &lt;STRONG&gt;stats&lt;/STRONG&gt; to join the two sides.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;More importantly, in this one, since one of the two groups is a subset of the other, you should do it this way:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=foo   my-search logon-action earliest=1 
| fields _time
| bin _time span=30m
| eval totalCount=1
| eval todayCount=if(_time&amp;gt;relative_time(now(),"-1d"),1,0)
| eval Time=strftime(_time,"%H:%M")
| stats sum(totalCount) as totalCount sum(todayCount) as todayCount  by Time&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And, by the way,&amp;nbsp;&lt;SPAN class=""&gt;&lt;A href="https://community.splunk.com/t5/user/viewprofilepage/user-id/184221" target="_self"&gt;to4kawa&lt;/A&gt;'s suggestion to use &lt;STRONG&gt;tstats&lt;/STRONG&gt; instead of a regular query is absolutely the right way to go, as long as all of the elements of your search were items that are index-time fields.&amp;nbsp; In this case they probably weren't, but here's how that would look if they were.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats count as totalCount where index=foo earliest=1  by _time span=30m
| eval todayCount=if(_time&amp;gt;relative_time(now(),"-1d"),totalCount,0)
| eval Time=strftime(_time,"%H:%M")
| stats sum(totalCount) as totalCount sum(todayCount) as todayCount  by Time&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2020 16:57:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-data-from-different-time-and-use-it-in-the-same/m-p/504473#M140814</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2020-06-15T16:57:56Z</dc:date>
    </item>
  </channel>
</rss>

