<?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 group by results? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-group-by-results/m-p/376740#M110584</link>
    <description>&lt;P&gt;For example:&lt;/P&gt;

&lt;P&gt;raw data is&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;100,x,info=1,error=1,warn=1
101,x,info=1,error=1,warn=1
101,y,info=1,error=2,warn=1
101,y,info=1,error=3,warn=1

| query
| chart count by x y 
| addtotals col=true labelfield=x label="Totals"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Sample results&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;event, info, error, warn  Total
 x         2        2         2       6
 y         2        5         2       9
Totals 4        7         4       15 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In the above query I want to sort the data based on group by query results in desc order. when i try | sort 0 -Totals, Totals column appearing first row in table.  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| query
| chart count by x y 
| addtotals col=true labelfield=x label="Totals"
| sort 0 -Total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Result:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;event, info, error, warn  Total
Totals 4        7         4       15
 y         2        5         2       9
 x         2        2         2       6
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But I want to display results as&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;event, info, error, warn  Total
 y         2        5         2       9
 x         2        2         2       6
Totals 4        7         4       15
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any inputs here really helps me. Thanks&lt;/P&gt;</description>
    <pubDate>Thu, 07 Jun 2018 17:28:06 GMT</pubDate>
    <dc:creator>ramki1459</dc:creator>
    <dc:date>2018-06-07T17:28:06Z</dc:date>
    <item>
      <title>How to sort group by results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-group-by-results/m-p/376740#M110584</link>
      <description>&lt;P&gt;For example:&lt;/P&gt;

&lt;P&gt;raw data is&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;100,x,info=1,error=1,warn=1
101,x,info=1,error=1,warn=1
101,y,info=1,error=2,warn=1
101,y,info=1,error=3,warn=1

| query
| chart count by x y 
| addtotals col=true labelfield=x label="Totals"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Sample results&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;event, info, error, warn  Total
 x         2        2         2       6
 y         2        5         2       9
Totals 4        7         4       15 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In the above query I want to sort the data based on group by query results in desc order. when i try | sort 0 -Totals, Totals column appearing first row in table.  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| query
| chart count by x y 
| addtotals col=true labelfield=x label="Totals"
| sort 0 -Total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Result:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;event, info, error, warn  Total
Totals 4        7         4       15
 y         2        5         2       9
 x         2        2         2       6
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But I want to display results as&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;event, info, error, warn  Total
 y         2        5         2       9
 x         2        2         2       6
Totals 4        7         4       15
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any inputs here really helps me. Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 17:28:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-group-by-results/m-p/376740#M110584</guid>
      <dc:creator>ramki1459</dc:creator>
      <dc:date>2018-06-07T17:28:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort group by results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-group-by-results/m-p/376741#M110585</link>
      <description>&lt;P&gt;i am able resolve my problem modifying query this &lt;BR /&gt;
`| query&lt;BR /&gt;
 | chart count by x y &lt;BR /&gt;
 | sort 0 info desc&lt;BR /&gt;
 | addtotals col=true labelfield=x label="Totals"&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 18:19:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-group-by-results/m-p/376741#M110585</guid>
      <dc:creator>ramki1459</dc:creator>
      <dc:date>2018-06-07T18:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort group by results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-group-by-results/m-p/376742#M110586</link>
      <description>&lt;P&gt;@ramki1459, I have converted your comment to answer. Please accept the same to mark this question as answered!&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 18:41:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-group-by-results/m-p/376742#M110586</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-06-07T18:41:40Z</dc:date>
    </item>
  </channel>
</rss>

