<?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: Display Graph Fields in Chronological Order in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Display-Graph-Fields-in-Chronological-Order/m-p/335945#M5049</link>
    <description>&lt;P&gt;@cmerriman, I think you will need to create fields like "01-January" etc to ensure 10 , 11 and 12 do not come after "1-January" after sort, since it will not be &lt;STRONG&gt;| sort num(date_month)&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 28 Jul 2017 09:08:20 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2017-07-28T09:08:20Z</dc:date>
    <item>
      <title>Display Graph Fields in Chronological Order</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Display-Graph-Fields-in-Chronological-Order/m-p/335943#M5047</link>
      <description>&lt;P&gt;I have a graph of percentages by region by month: &lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3278i78C406F98C073605/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;However, the months are not displaying in the correct chronological order. Splunk is not recognizing my date_month field as containing time.&lt;/P&gt;

&lt;P&gt;I need to change something with strptime or strftime, but I'm not exactly sure what.&lt;/P&gt;

&lt;P&gt;Here is the code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=webex_sentiment 
| eval surveyDate=strptime(Started,"%m/%d/%Y %H:%M") 
|  eval Country=upper(Country) 
| lookup CountryDetails Country OUTPUT Region 
| stats  count(Rating) as NumberRatings by date_month Rating Region  
| eventstats  sum(NumberRatings) as TotalRatings by date_month Region  
| eval  PercentageRatings=round(NumberRatings/TotalRatings,3)  
| where  Rating=1 OR Rating=2  
| chart  sum(PercentageRatings) as NegativeSentiment by date_month Region
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please advise&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 20:34:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Display-Graph-Fields-in-Chronological-Order/m-p/335943#M5047</guid>
      <dc:creator>mhtedford</dc:creator>
      <dc:date>2017-07-27T20:34:23Z</dc:date>
    </item>
    <item>
      <title>Re: Display Graph Fields in Chronological Order</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Display-Graph-Fields-in-Chronological-Order/m-p/335944#M5048</link>
      <description>&lt;P&gt;Splunk always displays that as alphanumeric. you need to write an eval to sort it properly. try something like this&lt;BR /&gt;
EDIT:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    index=webex_sentiment 
     | eval surveyDate=strptime(Started,"%m/%d/%Y %H:%M") 
     |  eval Country=upper(Country) 
     | lookup CountryDetails Country OUTPUT Region 
     | stats  count(Rating) as NumberRatings by date_month Rating Region  
     | eventstats  sum(NumberRatings) as TotalRatings by date_month Region  
     | eval  PercentageRatings=round(NumberRatings/TotalRatings,3)  
     | where  Rating=1 OR Rating=2  
  |eval monthNum=case(date_month="january",1,date_month="february",2,date_month="march",3,date_month="april",4,date_month="may",5,
date_month="june",6,date_month="july",7,date_month="august",8,date_month="september",9,date_month="october",10,date_month="november",11,
date_month="december",12)
    | chart  sum(PercentageRatings) as NegativeSentiment by monthNum Region
    |sort 0 monthNum 
    |eval Month=case(monthNum=1,"January",monthNum=2,"February",monthNum=3,"March",monthNum=4,"April",monthNum=5,"May",
monthNum=6,"June",monthNum=7,"July",monthNum=8,"August",monthNum=9,"September",monthNum=10,"October",monthNum=11,"November",
monthNum=12,"December")|fields - monthNum
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;ORIGINAL:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=webex_sentiment 
 | eval surveyDate=strptime(Started,"%m/%d/%Y %H:%M") 
 |  eval Country=upper(Country) 
 | lookup CountryDetails Country OUTPUT Region 
 | stats  count(Rating) as NumberRatings by date_month Rating Region  
 | eventstats  sum(NumberRatings) as TotalRatings by date_month Region  
 | eval  PercentageRatings=round(NumberRatings/TotalRatings,3)  
 | where  Rating=1 OR Rating=2  
|eval date_month=case(date_month="january","1-January",date_month="february","2-February",date_month="march","3-March",date_month="april","4-April",date_month="may","5-May",date_month="june","6-June",date_month="july","7-July",date_month="august","8-August",date_month="september","9-September",date_month="october","10-October",date_month="november","11-November",date_month="december","12-December")
| chart  sum(PercentageRatings) as NegativeSentiment by date_month Region
|sort 0 date_month
|rex field=date_month "-(?&amp;lt;date_month&amp;gt;\w+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Jul 2017 20:39:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Display-Graph-Fields-in-Chronological-Order/m-p/335944#M5048</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-07-27T20:39:47Z</dc:date>
    </item>
    <item>
      <title>Re: Display Graph Fields in Chronological Order</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Display-Graph-Fields-in-Chronological-Order/m-p/335945#M5049</link>
      <description>&lt;P&gt;@cmerriman, I think you will need to create fields like "01-January" etc to ensure 10 , 11 and 12 do not come after "1-January" after sort, since it will not be &lt;STRONG&gt;| sort num(date_month)&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2017 09:08:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Display-Graph-Fields-in-Chronological-Order/m-p/335945#M5049</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-07-28T09:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: Display Graph Fields in Chronological Order</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Display-Graph-Fields-in-Chronological-Order/m-p/335946#M5050</link>
      <description>&lt;P&gt;good catch! i even mentioned alphanumeric and then i go ahead and create an alphanumeric field! silly me. &lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2017 11:59:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Display-Graph-Fields-in-Chronological-Order/m-p/335946#M5050</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-07-28T11:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: Display Graph Fields in Chronological Order</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Display-Graph-Fields-in-Chronological-Order/m-p/335947#M5051</link>
      <description>&lt;P&gt;Could it be significantly simplified if you use, to derive the date category information "01-January", some variation of ...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval date_month=strftime(_time, "%m-%B") ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;See this run-anywhere example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval date_month=strftime(_time, "%m-%B")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which gives you a &lt;CODE&gt;date_month&lt;/CODE&gt; equal to, right now, &lt;CODE&gt;07-July&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Refer to &lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/6.6.0/SearchReference/Commontimeformatvariables"&gt;Splunk date and time format variables&lt;/A&gt;)&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2017 13:51:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Display-Graph-Fields-in-Chronological-Order/m-p/335947#M5051</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2017-07-28T13:51:46Z</dc:date>
    </item>
  </channel>
</rss>

