<?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: Why are the numbers not sorted as expected in my chart? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-are-the-numbers-not-sorted-as-expected-in-my-chart/m-p/268620#M80802</link>
    <description>&lt;P&gt;Give this a try (assuming "DIA CIERRE" always starts with 1.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="bucle_cm" sourcetype="cierres-pendientes" "Tipo Actuacion"="*" "Tipo Actuacion"!=Bajas EMPRES="*" | chart count by "Tipo Actuacion","DIA CIERRE" limit=0 | addcoltotals  | addtotals fieldname=Total | table [search index="bucle_cm" sourcetype="cierres-pendientes" "Tipo Actuacion"="*" "Tipo Actuacion"!=Bajas EMPRES="*"  | stats max("DIA CIERRE") as t | eval search=mvrange(1,t,1) | stats list(search) as search delim="," | nomv search ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 24 May 2016 19:20:35 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2016-05-24T19:20:35Z</dc:date>
    <item>
      <title>Why are the numbers not sorted as expected in my chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-are-the-numbers-not-sorted-as-expected-in-my-chart/m-p/268611#M80793</link>
      <description>&lt;P&gt;Hi all.&lt;/P&gt;

&lt;P&gt;I have this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="bucle_cm" sourcetype="cierres-pendientes" "Tipo Actuacion"="*" "Tipo Actuacion"!=Bajas EMPRES="*" | sort num("DIA CIERRE") | chart count by "Tipo Actuacion","DIA CIERRE" limit=0 | addcoltotals  | addtotals fieldname=Total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Where &lt;CODE&gt;"DIA CIERRE"&lt;/CODE&gt; is a number field with values like 1,2,3,4,10,11..etc.&lt;/P&gt;

&lt;P&gt;The result set looks like this:&lt;/P&gt;

&lt;P&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/1404iAE24D24EE46ED514/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;Why are the numbers not sorted?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2016 16:52:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-are-the-numbers-not-sorted-as-expected-in-my-chart/m-p/268611#M80793</guid>
      <dc:creator>changux</dc:creator>
      <dc:date>2016-05-24T16:52:26Z</dc:date>
    </item>
    <item>
      <title>Re: Why are the numbers not sorted as expected in my chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-are-the-numbers-not-sorted-as-expected-in-my-chart/m-p/268612#M80794</link>
      <description>&lt;P&gt;The field names in Splunk are treated as alphanumeric string, not number, hence the column ordering you see here. The sort command before the chart will not have any effect on the output of the chart command.&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2016 16:57:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-are-the-numbers-not-sorted-as-expected-in-my-chart/m-p/268612#M80794</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-05-24T16:57:50Z</dc:date>
    </item>
    <item>
      <title>Re: Why are the numbers not sorted as expected in my chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-are-the-numbers-not-sorted-as-expected-in-my-chart/m-p/268613#M80795</link>
      <description>&lt;P&gt;Thanks. Putting the &lt;CODE&gt;sort&lt;/CODE&gt; after the &lt;CODE&gt;chart&lt;/CODE&gt; command give the same ordering issue. &lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2016 17:02:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-are-the-numbers-not-sorted-as-expected-in-my-chart/m-p/268613#M80795</guid>
      <dc:creator>changux</dc:creator>
      <dc:date>2016-05-24T17:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: Why are the numbers not sorted as expected in my chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-are-the-numbers-not-sorted-as-expected-in-my-chart/m-p/268614#M80796</link>
      <description>&lt;P&gt;There is no good way to sort columns with numbers in it. Do you know if "DIA CIERRE" has fixed number of values??&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2016 17:06:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-are-the-numbers-not-sorted-as-expected-in-my-chart/m-p/268614#M80796</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-05-24T17:06:09Z</dc:date>
    </item>
    <item>
      <title>Re: Why are the numbers not sorted as expected in my chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-are-the-numbers-not-sorted-as-expected-in-my-chart/m-p/268615#M80797</link>
      <description>&lt;P&gt;"DIA CIERRE" is a day in a month, so, in the worst case, you have 31 as fixed value.&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2016 17:09:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-are-the-numbers-not-sorted-as-expected-in-my-chart/m-p/268615#M80797</guid>
      <dc:creator>changux</dc:creator>
      <dc:date>2016-05-24T17:09:27Z</dc:date>
    </item>
    <item>
      <title>Re: Why are the numbers not sorted as expected in my chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-are-the-numbers-not-sorted-as-expected-in-my-chart/m-p/268616#M80798</link>
      <description>&lt;P&gt;Does it's value depends upon the time range you run the query for? In other words, is there a way I can find out the max value of "DIA CIERRE" which your search is going to return? I've a workaround but I need to know the max value (and the start value).&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2016 18:00:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-are-the-numbers-not-sorted-as-expected-in-my-chart/m-p/268616#M80798</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-05-24T18:00:14Z</dc:date>
    </item>
    <item>
      <title>Re: Why are the numbers not sorted as expected in my chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-are-the-numbers-not-sorted-as-expected-in-my-chart/m-p/268617#M80799</link>
      <description>&lt;P&gt;With a subsearch like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats max("DIA CIERRE")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;We can obtain this one. In the last case is 11.&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2016 18:36:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-are-the-numbers-not-sorted-as-expected-in-my-chart/m-p/268617#M80799</guid>
      <dc:creator>changux</dc:creator>
      <dc:date>2016-05-24T18:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: Why are the numbers not sorted as expected in my chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-are-the-numbers-not-sorted-as-expected-in-my-chart/m-p/268618#M80800</link>
      <description>&lt;P&gt;how about something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;....| eval "DIA CIERRE"=if(len("DIA CIERRE")=1, "0".'DIA CIERRE', 'DIA CIERRE') | chart count over "TIPO"  by "DIA CIERRE"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then max value wouldn't matter&lt;BR /&gt;
Full search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="bucle_cm" sourcetype="cierres-pendientes" "Tipo Actuacion"="*" "Tipo Actuacion"!=Bajas EMPRES="*" .| eval "DIA CIERRE"=if(len("DIA CIERRE")=1, "0".'DIA CIERRE', 'DIA CIERRE') | chart count over "TIPO"  by "DIA CIERRE" | addcoltotals  | addtotals fieldname=Total
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 May 2016 18:48:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-are-the-numbers-not-sorted-as-expected-in-my-chart/m-p/268618#M80800</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-05-24T18:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: Why are the numbers not sorted as expected in my chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-are-the-numbers-not-sorted-as-expected-in-my-chart/m-p/268619#M80801</link>
      <description>&lt;P&gt;Hi.&lt;BR /&gt;
I tried first:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval "DIA CIERRE"=if(len('DIA CIERRE')=1, "0".y, y) | table "DIA CIERRE"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And not results. Can you explain please your idea?&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2016 18:59:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-are-the-numbers-not-sorted-as-expected-in-my-chart/m-p/268619#M80801</guid>
      <dc:creator>changux</dc:creator>
      <dc:date>2016-05-24T18:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: Why are the numbers not sorted as expected in my chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-are-the-numbers-not-sorted-as-expected-in-my-chart/m-p/268620#M80802</link>
      <description>&lt;P&gt;Give this a try (assuming "DIA CIERRE" always starts with 1.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="bucle_cm" sourcetype="cierres-pendientes" "Tipo Actuacion"="*" "Tipo Actuacion"!=Bajas EMPRES="*" | chart count by "Tipo Actuacion","DIA CIERRE" limit=0 | addcoltotals  | addtotals fieldname=Total | table [search index="bucle_cm" sourcetype="cierres-pendientes" "Tipo Actuacion"="*" "Tipo Actuacion"!=Bajas EMPRES="*"  | stats max("DIA CIERRE") as t | eval search=mvrange(1,t,1) | stats list(search) as search delim="," | nomv search ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 May 2016 19:20:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-are-the-numbers-not-sorted-as-expected-in-my-chart/m-p/268620#M80802</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-05-24T19:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: Why are the numbers not sorted as expected in my chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-are-the-numbers-not-sorted-as-expected-in-my-chart/m-p/268621#M80803</link>
      <description>&lt;P&gt;Replace y with 'DIA CIERRE'.&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2016 19:21:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-are-the-numbers-not-sorted-as-expected-in-my-chart/m-p/268621#M80803</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-05-24T19:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: Why are the numbers not sorted as expected in my chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-are-the-numbers-not-sorted-as-expected-in-my-chart/m-p/268622#M80804</link>
      <description>&lt;P&gt;This could work just fine...since max value is 31 (2 digit)&lt;BR /&gt;
Much simpler than mine...&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2016 19:24:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-are-the-numbers-not-sorted-as-expected-in-my-chart/m-p/268622#M80804</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-05-24T19:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: Why are the numbers not sorted as expected in my chart?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-are-the-numbers-not-sorted-as-expected-in-my-chart/m-p/268623#M80805</link>
      <description>&lt;P&gt;Works great! Awesome @somesoni2. Thanks a lot!!&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2016 19:53:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-are-the-numbers-not-sorted-as-expected-in-my-chart/m-p/268623#M80805</guid>
      <dc:creator>changux</dc:creator>
      <dc:date>2016-05-24T19:53:11Z</dc:date>
    </item>
  </channel>
</rss>

