<?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 create a table depending on quarters and intervals? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-depending-on-quarters-and-intervals/m-p/313050#M93711</link>
    <description>&lt;P&gt;Could you explain differently?   Or at least confirm this re-statement? - &lt;/P&gt;

&lt;P&gt;You'd like a count of numbers falling into each of those specific buckets, divided up by quarters.&lt;/P&gt;

&lt;P&gt;Does that sound right?&lt;/P&gt;</description>
    <pubDate>Sun, 15 Oct 2017 14:01:04 GMT</pubDate>
    <dc:creator>Richfez</dc:creator>
    <dc:date>2017-10-15T14:01:04Z</dc:date>
    <item>
      <title>How to create a table depending on quarters and intervals?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-depending-on-quarters-and-intervals/m-p/313049#M93710</link>
      <description>&lt;P&gt;Hi Team, &lt;/P&gt;

&lt;P&gt;I have data of several years sorted by specific dates and numbers. And I would like to display them on quaterly basis into table and devide numbers into six intervals (0-0,01;0,011-0,03;0,301-0,1;0,101-1;1,001-5;5+). Moreover there is not every day any activity but then there are days with many rows.&lt;/P&gt;

&lt;P&gt;Can anybody help me with the solution how to solve this? &lt;BR /&gt;
I have googled but haven't found anything.&lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Sun, 15 Oct 2017 13:17:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-depending-on-quarters-and-intervals/m-p/313049#M93710</guid>
      <dc:creator>Terka117</dc:creator>
      <dc:date>2017-10-15T13:17:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a table depending on quarters and intervals?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-depending-on-quarters-and-intervals/m-p/313050#M93711</link>
      <description>&lt;P&gt;Could you explain differently?   Or at least confirm this re-statement? - &lt;/P&gt;

&lt;P&gt;You'd like a count of numbers falling into each of those specific buckets, divided up by quarters.&lt;/P&gt;

&lt;P&gt;Does that sound right?&lt;/P&gt;</description>
      <pubDate>Sun, 15 Oct 2017 14:01:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-depending-on-quarters-and-intervals/m-p/313050#M93711</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2017-10-15T14:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a table depending on quarters and intervals?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-depending-on-quarters-and-intervals/m-p/313051#M93712</link>
      <description>&lt;P&gt;Almost, I would like to sum those numbers up, not count. But the rest is correct &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Sun, 15 Oct 2017 14:17:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-depending-on-quarters-and-intervals/m-p/313051#M93712</guid>
      <dc:creator>Terka117</dc:creator>
      <dc:date>2017-10-15T14:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a table depending on quarters and intervals?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-depending-on-quarters-and-intervals/m-p/313052#M93713</link>
      <description>&lt;P&gt;We can't interpret your intervals, because the number of dashes, leading zeroes, commas and semicolon do not make any obvious pattern.  &lt;/P&gt;

&lt;P&gt;So, we're just going to make stuff up. &lt;/P&gt;

&lt;P&gt;Let's suppose that you have data that has the date and a number.  Let's say, so we can be concrete about it, that the number is the total number of movie tickets sold for a particular show, and that some days the movie theater is closed and other days it has many packed shows.&lt;/P&gt;

&lt;P&gt;This first section just creates some test data.  Your actual process will do something else, obviously.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    | makeresults 
    | eval mydata="2017-10-01,12 2017-10-01,21 2017-10-02,10 2017-10-03,14 2017-10-03,32 2017-10-07,12 2017-10-05,1 2017-10-06,13 2017-10-06,25 2017-10-06,12 2017-10-07,18 2017-10-07,16" 
    | makemv mydata 
    | mvexpand mydata 
    | makemv delim="," mydata 
    | eval myDate=mvindex(mydata,0) 
    | eval myCount=mvindex(mydata,1) | table myDate myCount
    | rename COMMENT as "the above enters one week's worth of test data with the date in myDate and the count in myCount"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This section does any necessary data conversion and then stats the ticket sales up by day...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    | rename COMMENT as "change the date into epoch time, bin at the day level (not needed here but useful to remember if you are looking at normal log events."
    | eval _time=strptime(myDate,"%Y-%m-%d")
    | bin _time span=1d

    | rename COMMENT as "add zero records for any days that might be missing, then sum it up by day."
    | appendpipe [
         | stats min(_time) as mintime max(_time) as maxtime 
         | eval myTimes = mvrange(mintime,maxtime+1,86400) 
         | mvexpand myTimes 
         | rename myTimes as _time 
         | table _time 
         | eval myCount=0
         ]
    | stats sum(myCount) as myCount by _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This section puts them into buckets.  Since we had no idea what you meant you wanted for buckets, we just used sets of ten.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    | rename COMMENT as "now you have one record per day. put the count value into your buckets and stats them up"
    | eval myBucket=case(isnull(myCount) or myCount=0, "01", 
        myCount&amp;lt;10, "02", 
        myCount&amp;lt;20, "03", 
        myCount&amp;lt;30, "04", 
        myCount&amp;lt;40, "05", 
        myCount&amp;gt;=40, "06")
    | stats count as daysInBucket by myBucket

    | rename COMMENT as "add a zero record for each bucket and stats em again to make sure all buckets are display"
    | append [
        | makeresults 
        | eval myBucket="01 02 03 04 05 06" 
        | table myBucket 
        | makemv myBucket 
        | mvexpand myBucket 
        | eval daysInBucket = 0 
        ]
    | stats sum(daysInBucket) as daysInBucket by myBucket
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And there you go.  &lt;/P&gt;</description>
      <pubDate>Fri, 20 Oct 2017 22:34:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-depending-on-quarters-and-intervals/m-p/313052#M93713</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-10-20T22:34:06Z</dc:date>
    </item>
  </channel>
</rss>

