<?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 sort data in chronological order by month, not alphabetically? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-data-in-chronological-order-by-month-not/m-p/368705#M108673</link>
    <description>&lt;P&gt;Hello, in my query below I get the months in numerical format, I use a the chart command to obtain a chart divided into 12 months with values for different years. I would like to know how to show the months with their respective names, sorted chronologically. Thank you.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="test.csv"
| eval Year=strftime(_time,"%Y") 
| eval month_num=strftime(_time, "%m") 
| chart distinct_count(ticket_number) as "Cantidad tickets" by month_num Year
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 07 Feb 2018 16:08:56 GMT</pubDate>
    <dc:creator>JuliDeza</dc:creator>
    <dc:date>2018-02-07T16:08:56Z</dc:date>
    <item>
      <title>How to sort data in chronological order by month, not alphabetically?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-data-in-chronological-order-by-month-not/m-p/368705#M108673</link>
      <description>&lt;P&gt;Hello, in my query below I get the months in numerical format, I use a the chart command to obtain a chart divided into 12 months with values for different years. I would like to know how to show the months with their respective names, sorted chronologically. Thank you.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="test.csv"
| eval Year=strftime(_time,"%Y") 
| eval month_num=strftime(_time, "%m") 
| chart distinct_count(ticket_number) as "Cantidad tickets" by month_num Year
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Feb 2018 16:08:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-data-in-chronological-order-by-month-not/m-p/368705#M108673</guid>
      <dc:creator>JuliDeza</dc:creator>
      <dc:date>2018-02-07T16:08:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort data in chronological order by month, not alphabetically?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-data-in-chronological-order-by-month-not/m-p/368706#M108674</link>
      <description>&lt;P&gt;Hi @JuliDeza,&lt;BR /&gt;
try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="test.csv"
 | eval Year=strftime(_time,"%Y") 
 | eval month=strftime(_time, "%B") 
 |sort - _time
 | chart distinct_count(ticket_number) as "Cantidad tickets" by month Year
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Feb 2018 16:20:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-data-in-chronological-order-by-month-not/m-p/368706#M108674</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-07T16:20:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort data in chronological order by month, not alphabetically?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-data-in-chronological-order-by-month-not/m-p/368707#M108675</link>
      <description>&lt;P&gt;Thanks for your answer @493669. It also changes the graph completely, showing only two months of the last year. The query should show the same graph, but changing the numbers by the names of the months. For that, the chart command counts and divides the data by month number and paints the data for different years in different colors.&lt;BR /&gt;
I had thought to use that query and then somehow change the numbers of the months by their corresponding name.&lt;BR /&gt;
or&lt;BR /&gt;
Use this other query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="test.csv"
| eval Year=strftime(_time,"%Y") 
| eval month=strftime(_time, "%B") 
| chart distinct_count(ticket_number) as "Cantidad tickets" by month Year
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And sort the months chronologically.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 19:38:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-data-in-chronological-order-by-month-not/m-p/368707#M108675</guid>
      <dc:creator>JuliDeza</dc:creator>
      <dc:date>2018-02-07T19:38:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort data in chronological order by month, not alphabetically?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-data-in-chronological-order-by-month-not/m-p/368708#M108676</link>
      <description>&lt;P&gt;Finally I solved it with this query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="test.csv"
| eval Year=strftime(_time,"%Y") 
| eval Month=date_month 
| chart distinct_count(ticket_number) as "Cantidad tickets" by Month Year 
| eval orden = if(Month="january",1,if(Month="february",2,if(Month="march",3,if(Month="april",4,if(Month="may",5,if(Month="june",6,if(Month="july",7,if(Month="august",8,if(Month="september",9,if(Month="october",10,if(Month="november",11,12))))))))))) 
| sort orden 
| fields - orden
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Feb 2018 19:11:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-data-in-chronological-order-by-month-not/m-p/368708#M108676</guid>
      <dc:creator>JuliDeza</dc:creator>
      <dc:date>2018-02-08T19:11:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort data in chronological order by month, not alphabetically?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-data-in-chronological-order-by-month-not/m-p/368709#M108677</link>
      <description>&lt;P&gt;You could have also probably done &lt;CODE&gt;| eval orden = stftime(_time, "%m")&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 20:04:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-data-in-chronological-order-by-month-not/m-p/368709#M108677</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-02-08T20:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort data in chronological order by month, not alphabetically?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-data-in-chronological-order-by-month-not/m-p/368710#M108678</link>
      <description>&lt;P&gt;Thanks but that does not work, that way the months are sorted alphabetically.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 20:12:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-data-in-chronological-order-by-month-not/m-p/368710#M108678</guid>
      <dc:creator>JuliDeza</dc:creator>
      <dc:date>2018-02-08T20:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort data in chronological order by month, not alphabetically?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-data-in-chronological-order-by-month-not/m-p/368711#M108679</link>
      <description>&lt;P&gt;I mean only swapping out line 5 in your search for the line I gave:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; source="test.csv"
 | eval Year=strftime(_time,"%Y") 
 | eval Month=date_month 
 | chart distinct_count(ticket_number) as "Cantidad tickets" by Month Year 
 | eval orden = strftime(_time, "%m")
 | sort orden 
 | fields - orden
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Feb 2018 20:15:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-data-in-chronological-order-by-month-not/m-p/368711#M108679</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-02-08T20:15:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort data in chronological order by month, not alphabetically?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-data-in-chronological-order-by-month-not/m-p/368712#M108680</link>
      <description>&lt;P&gt;these queries sorts data either by month or year.&lt;BR /&gt;
My requirement is to sort by both month and year.&lt;BR /&gt;
for eg May 2017,June 2018 , May 2018,July 2018,June 2019&lt;BR /&gt;
Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 09:11:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-data-in-chronological-order-by-month-not/m-p/368712#M108680</guid>
      <dc:creator>abhishekroy168</dc:creator>
      <dc:date>2018-03-06T09:11:16Z</dc:date>
    </item>
  </channel>
</rss>

