<?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 with months along with two other types of data summed? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-with-months-along-with-two-other-types-of/m-p/378201#M110885</link>
    <description>&lt;P&gt;That works, now how would I sort the table by year and then by month?  &lt;/P&gt;</description>
    <pubDate>Fri, 27 Jul 2018 19:53:16 GMT</pubDate>
    <dc:creator>larswu</dc:creator>
    <dc:date>2018-07-27T19:53:16Z</dc:date>
    <item>
      <title>How to create a table with months along with two other types of data summed?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-with-months-along-with-two-other-types-of/m-p/378195#M110879</link>
      <description>&lt;P&gt;I would like to create a table out of a search with months (date_month) on the first column, then the sum of all unique website cart numbers (ODE_CART_NUMBER) in the next column, then the third column would be a sum of all of the files associated with all of the carts in each month (file).  &lt;/P&gt;

&lt;P&gt;The table would look like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Month              #of Carts                Total Files 
Jan                     12                            150
Feb                     27                           265
March               16                             200
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm still getting to know Splunk.  I tried a few variations of piping tables and sums but I cannot get it to give me what I want.  My current base search is below.  I created a custom field to extract the ODE_CART_NUMBER field&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host="ASPERA-2" op="send" status="success"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:40:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-with-months-along-with-two-other-types-of/m-p/378195#M110879</guid>
      <dc:creator>larswu</dc:creator>
      <dc:date>2020-09-29T20:40:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a table with months along with two other types of data summed?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-with-months-along-with-two-other-types-of/m-p/378196#M110880</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| stats dc(ODE_CART_NUMBER) as "#of Carts" count(file) as "Files" by date_month
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Jul 2018 19:37:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-with-months-along-with-two-other-types-of/m-p/378196#M110880</guid>
      <dc:creator>kmaron</dc:creator>
      <dc:date>2018-07-27T19:37:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a table with months along with two other types of data summed?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-with-months-along-with-two-other-types-of/m-p/378197#M110881</link>
      <description>&lt;P&gt;That's great!  Would it be possible to add the year (date_year)  as a column and then sort by year and then month?  &lt;/P&gt;</description>
      <pubDate>Fri, 27 Jul 2018 19:43:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-with-months-along-with-two-other-types-of/m-p/378197#M110881</guid>
      <dc:creator>larswu</dc:creator>
      <dc:date>2018-07-27T19:43:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a table with months along with two other types of data summed?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-with-months-along-with-two-other-types-of/m-p/378198#M110882</link>
      <description>&lt;P&gt;yup just add it to the 'by'&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | stats dc(ODE_CART_NUMBER) as "#of Carts" count(file) as "Files" by date_month date_year
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Jul 2018 19:47:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-with-months-along-with-two-other-types-of/m-p/378198#M110882</guid>
      <dc:creator>kmaron</dc:creator>
      <dc:date>2018-07-27T19:47:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a table with months along with two other types of data summed?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-with-months-along-with-two-other-types-of/m-p/378199#M110883</link>
      <description>&lt;P&gt;You should be able to do that with the &lt;CODE&gt;stats&lt;/CODE&gt; command.  I used the &lt;CODE&gt;sum&lt;/CODE&gt; function because that's the term used in the question, but you may want to use &lt;CODE&gt;count&lt;/CODE&gt;, instead.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | stats sum(ODE_CART_NUMBER) sum(file) by date_month
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Jul 2018 19:48:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-with-months-along-with-two-other-types-of/m-p/378199#M110883</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2018-07-27T19:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a table with months along with two other types of data summed?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-with-months-along-with-two-other-types-of/m-p/378200#M110884</link>
      <description>&lt;P&gt;now when you sort it's going to sort your months in alphabetical order.  If you don't want that you should check out this post that helps fix that:  &lt;A href="https://answers.splunk.com/answers/170706/how-to-sort-data-in-chronological-order-by-month-n.html"&gt;https://answers.splunk.com/answers/170706/how-to-sort-data-in-chronological-order-by-month-n.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jul 2018 19:50:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-with-months-along-with-two-other-types-of/m-p/378200#M110884</guid>
      <dc:creator>kmaron</dc:creator>
      <dc:date>2018-07-27T19:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a table with months along with two other types of data summed?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-with-months-along-with-two-other-types-of/m-p/378201#M110885</link>
      <description>&lt;P&gt;That works, now how would I sort the table by year and then by month?  &lt;/P&gt;</description>
      <pubDate>Fri, 27 Jul 2018 19:53:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-with-months-along-with-two-other-types-of/m-p/378201#M110885</guid>
      <dc:creator>larswu</dc:creator>
      <dc:date>2018-07-27T19:53:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a table with months along with two other types of data summed?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-with-months-along-with-two-other-types-of/m-p/378202#M110886</link>
      <description>&lt;P&gt;just a straight sort would be &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| sort date_year date_month   
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;for ascending&lt;BR /&gt;
or &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| sort - date_year - date_month   
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;for descending&lt;/P&gt;

&lt;P&gt;If you want the months in chronological order instead of alphabetical order you'll need to do some finagling with assigning numbers to the months.  I liked another answers post in the previous comment that can help you with that. &lt;/P&gt;</description>
      <pubDate>Fri, 27 Jul 2018 19:57:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-with-months-along-with-two-other-types-of/m-p/378202#M110886</guid>
      <dc:creator>kmaron</dc:creator>
      <dc:date>2018-07-27T19:57:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a table with months along with two other types of data summed?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-with-months-along-with-two-other-types-of/m-p/378203#M110887</link>
      <description>&lt;P&gt;Try like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host="ASPERA-2" op="send" status="success"
| timechart span=1mon dc(ODE_CART_NUMBER) as "#of Carts" count(file) as "Files" 
| rename COMMENT as "Comment only, remove this line. Above line will automatically sort the ouput in ascending order of time. Next just get your formatted year/month"
| eval Year=strftime(_time,"%Y") | eval Month=strftime(_time,"%B") 
| table Year Month  "#of Carts"  "Files" 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Jul 2018 20:33:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-table-with-months-along-with-two-other-types-of/m-p/378203#M110887</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-07-27T20:33:54Z</dc:date>
    </item>
  </channel>
</rss>

