<?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: Simple Column sorting (with variable column name) in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Simple-Column-sorting-with-variable-column-name/m-p/333628#M99214</link>
    <description>&lt;P&gt;Label the columns 2017_Q1 etc and they will naturally sort into order.  (Ascending order.) Get yourself into the habit of using ISO date format (yyyy-mm-dd) and you will save yourself eons of time, since they can be compared directly and sorted without translation to epoch time.&lt;/P&gt;</description>
    <pubDate>Mon, 11 Dec 2017 16:51:17 GMT</pubDate>
    <dc:creator>DalJeanis</dc:creator>
    <dc:date>2017-12-11T16:51:17Z</dc:date>
    <item>
      <title>Simple Column sorting (with variable column name)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-Column-sorting-with-variable-column-name/m-p/333627#M99213</link>
      <description>&lt;P&gt;Hi Guys &lt;/P&gt;

&lt;P&gt;context:&lt;BR /&gt;
   i want a table grouped by region, count per region and quarter in a table&lt;BR /&gt;
   for example &lt;BR /&gt;
   Region, Cases 02/2017, Cases 01/2017&lt;BR /&gt;
   1, 200456, 30489&lt;BR /&gt;
   2, 3208342, 9123123&lt;/P&gt;

&lt;P&gt;search (label_q1 and label_q2 are created at runtime in my_nasty_search and containing the label for the last quarters):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;my_nasty_search 
 | stats first(label_q1) as label_q1, first(label_q2) as label_q2, sum(total1) as total1, sum(total2) as total2, count(region) as count_region by region
 | eval Cases {label_q1} = total1
 | eval Cases {label_q2} = total2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This gives me as an result a table with the following columns &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Region, count_region, label_q1, label_q2, total1, total2, Cases Q1/2017, Cases Q2/2017
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;which is absolutly okay, but i prefer to have the last two columns sorte by my predefined order (Q2/2017; Q1/2017;Q4/2016 ... ) but all new fields get arange by splunk. Because of the variable columnname i can't just resort them with the fields command, as fields doesn't accept variable column names.&lt;/P&gt;

&lt;P&gt;I am happy for any suggestions, also if looking at the context I'am just on the wrong path.&lt;/P&gt;

&lt;P&gt;Thx &lt;BR /&gt;
Christian &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:11:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-Column-sorting-with-variable-column-name/m-p/333627#M99213</guid>
      <dc:creator>christianhuber</dc:creator>
      <dc:date>2020-09-29T17:11:17Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Column sorting (with variable column name)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-Column-sorting-with-variable-column-name/m-p/333628#M99214</link>
      <description>&lt;P&gt;Label the columns 2017_Q1 etc and they will naturally sort into order.  (Ascending order.) Get yourself into the habit of using ISO date format (yyyy-mm-dd) and you will save yourself eons of time, since they can be compared directly and sorted without translation to epoch time.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 16:51:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-Column-sorting-with-variable-column-name/m-p/333628#M99214</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-12-11T16:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Column sorting (with variable column name)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-Column-sorting-with-variable-column-name/m-p/333629#M99215</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;I'am aware of the date format, the translation to epoch time is desired, input date contains various time formats and converting it to epoch has some nice advanteges as you get a integer value and can easily calculate. &lt;/P&gt;

&lt;P&gt;Unfortunatly the column name is defined and i can't just give them another name. &lt;/P&gt;

&lt;P&gt;thanks for your reply&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2017 08:22:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-Column-sorting-with-variable-column-name/m-p/333629#M99215</guid>
      <dc:creator>christianhuber</dc:creator>
      <dc:date>2017-12-12T08:22:10Z</dc:date>
    </item>
  </channel>
</rss>

