<?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: How to sort by row totals from highest to lowest? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-row-totals-from-highest-to-lowest/m-p/117259#M31217</link>
    <description>&lt;P&gt;Can you please provide a sample table of what this might look like?&lt;/P&gt;</description>
    <pubDate>Thu, 13 Nov 2014 17:09:46 GMT</pubDate>
    <dc:creator>aweitzman</dc:creator>
    <dc:date>2014-11-13T17:09:46Z</dc:date>
    <item>
      <title>How to sort by row totals from highest to lowest?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-row-totals-from-highest-to-lowest/m-p/117256#M31214</link>
      <description>&lt;P&gt;Hi Folks,&lt;BR /&gt;
I'm having problems sorting a chart. I want to take the overall totals in one row and sort by that. Here's a simple version:&lt;/P&gt;

&lt;P&gt;index=customerchoice snackChoice=fruit | chart count(eval(fruitName=apple)) as APPLE, count(eval(fruitName=banana)) as BANANA, count(eval(fruitName=orange)) as ORANGE by customerName&lt;/P&gt;

&lt;P&gt;I can make this into a chart and it looks good, but it is only pulling the customer names alphabetically. I'd like to see who ate the most fruit total on top, but the top command just zeros out all my fields, weirdly (so I know I'm using it wrong). SO if Bill ate 7 apples, 6 bananas and 12 oranges, he would be above Jill who only ate one of each. But if Zack ate 40 oranges, he would end up on top. Hope that makes sense&lt;/P&gt;</description>
      <pubDate>Thu, 13 Nov 2014 16:38:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-row-totals-from-highest-to-lowest/m-p/117256#M31214</guid>
      <dc:creator>jravida</dc:creator>
      <dc:date>2014-11-13T16:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort by row totals from highest to lowest?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-row-totals-from-highest-to-lowest/m-p/117257#M31215</link>
      <description>&lt;P&gt;Just create a sum, sort by that, and then remove the sum field so it doesn't end up in the graph:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...your search... | eval allfruit=APPLE+BANANA+ORANGE | sort -allfruit | fields - allfruit
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Nov 2014 16:47:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-row-totals-from-highest-to-lowest/m-p/117257#M31215</guid>
      <dc:creator>aweitzman</dc:creator>
      <dc:date>2014-11-13T16:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort by row totals from highest to lowest?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-row-totals-from-highest-to-lowest/m-p/117258#M31216</link>
      <description>&lt;P&gt;I tried this but it is still sorting alphabetically. I don't think the eval statement works because there is only one occurrence of fruitchoice per meal. So in a single log of a complete meal, it would only say apple, banana or orange for the field, not a value. Sorry if I was unclear.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Nov 2014 17:04:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-row-totals-from-highest-to-lowest/m-p/117258#M31216</guid>
      <dc:creator>jravida</dc:creator>
      <dc:date>2014-11-13T17:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort by row totals from highest to lowest?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-row-totals-from-highest-to-lowest/m-p/117259#M31217</link>
      <description>&lt;P&gt;Can you please provide a sample table of what this might look like?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Nov 2014 17:09:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-row-totals-from-highest-to-lowest/m-p/117259#M31217</guid>
      <dc:creator>aweitzman</dc:creator>
      <dc:date>2014-11-13T17:09:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort by row totals from highest to lowest?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-row-totals-from-highest-to-lowest/m-p/117260#M31218</link>
      <description>&lt;P&gt;I'm just gonna type it out because it's on a standalone, sorry it looks ugly, this website crams it all together&lt;/P&gt;

&lt;P&gt;CustomerName           APPLE            ORANGE          BANANA&lt;BR /&gt;
Angela                            1                      0                         5&lt;BR /&gt;
Bill                                   7                     5                         15&lt;BR /&gt;
Mark                                0                    0                          1&lt;BR /&gt;
Steve                                24                  8                          0&lt;/P&gt;

&lt;P&gt;So I would want Steve, then Bill, Angela, Mark, for the total of fruit they took&lt;BR /&gt;
Hope this looks OK&lt;/P&gt;</description>
      <pubDate>Thu, 13 Nov 2014 17:16:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-row-totals-from-highest-to-lowest/m-p/117260#M31218</guid>
      <dc:creator>jravida</dc:creator>
      <dc:date>2014-11-13T17:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort by row totals from highest to lowest?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-row-totals-from-highest-to-lowest/m-p/117261#M31219</link>
      <description>&lt;P&gt;That's pretty much what I thought it would look like. If you just add&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval allfruit=APPLE+BANANA+ORANGE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;do you get another column with the sum?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Nov 2014 17:21:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-row-totals-from-highest-to-lowest/m-p/117261#M31219</guid>
      <dc:creator>aweitzman</dc:creator>
      <dc:date>2014-11-13T17:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort by row totals from highest to lowest?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-row-totals-from-highest-to-lowest/m-p/117262#M31220</link>
      <description>&lt;P&gt;Nope, the column says APPLEBANANAORANGE for every customer&lt;/P&gt;</description>
      <pubDate>Thu, 13 Nov 2014 17:25:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-row-totals-from-highest-to-lowest/m-p/117262#M31220</guid>
      <dc:creator>jravida</dc:creator>
      <dc:date>2014-11-13T17:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort by row totals from highest to lowest?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-row-totals-from-highest-to-lowest/m-p/117263#M31221</link>
      <description>&lt;P&gt;Weird. What if you put single quotes around the field names?&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;PRE&gt;&lt;CODE&gt;| eval allfruit='APPLE'+'BANANA'+'ORANGE'
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;(Also, what version of Splunk are you using?)&lt;/P&gt;</description>
      <pubDate>Thu, 13 Nov 2014 17:41:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-row-totals-from-highest-to-lowest/m-p/117263#M31221</guid>
      <dc:creator>aweitzman</dc:creator>
      <dc:date>2014-11-13T17:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort by row totals from highest to lowest?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-row-totals-from-highest-to-lowest/m-p/117264#M31222</link>
      <description>&lt;P&gt;That didn't work either...&lt;/P&gt;

&lt;P&gt;I managed to get the display using:&lt;/P&gt;

&lt;P&gt;... |addtotals | sort -Total | fields - Total&lt;/P&gt;</description>
      <pubDate>Thu, 13 Nov 2014 18:47:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-row-totals-from-highest-to-lowest/m-p/117264#M31222</guid>
      <dc:creator>jravida</dc:creator>
      <dc:date>2014-11-13T18:47:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort by row totals from highest to lowest?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-row-totals-from-highest-to-lowest/m-p/117265#M31223</link>
      <description>&lt;P&gt;Well, I'm glad you found something that works. I have never had it behave the way you described above, and as you might expect, "it works on my machine" :-), so I'm not sure where my suggestions went wrong. But the important thing is that you've solved your problem.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Nov 2014 19:17:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-by-row-totals-from-highest-to-lowest/m-p/117265#M31223</guid>
      <dc:creator>aweitzman</dc:creator>
      <dc:date>2014-11-13T19:17:02Z</dc:date>
    </item>
  </channel>
</rss>

