<?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 the counts of the sub-category items in the categories? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-counts-of-the-sub-category-items-in-the/m-p/566071#M197250</link>
    <description>&lt;P&gt;The eval you suggested doesn't do what you might think. What is it that you are trying to achieve?&lt;/P&gt;</description>
    <pubDate>Tue, 07 Sep 2021 07:24:25 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2021-09-07T07:24:25Z</dc:date>
    <item>
      <title>How to sort the counts of the sub-category items in the categories?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-counts-of-the-sub-category-items-in-the/m-p/565923#M197193</link>
      <description>&lt;P&gt;&lt;SPAN class="VIiyi"&gt;&lt;SPAN class="JLqJ4b ChMk0b"&gt;&lt;SPAN&gt;Hi Splunkers,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="VIiyi"&gt;&lt;SPAN class="JLqJ4b ChMk0b"&gt;&lt;SPAN&gt;&lt;BR /&gt;My event example is as follows. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;fruit_type	size
---------------
apple		big
banana		medium
melon		small
banana		small
apple		small
apple		small
apple		medium
melon		big
melon		big
melon		big&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="VIiyi"&gt;&lt;SPAN class="JLqJ4b ChMk0b"&gt;&lt;SPAN&gt;My chart is as follows&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="VIiyi"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="sort.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/15847i6790B3798C8E7B23/image-size/large?v=v2&amp;amp;px=999" role="button" title="sort.png" alt="sort.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;How to sort the counts of the sub-category(like size) items in the differ category(such as fruit_type) at once?&lt;/P&gt;&lt;P&gt;&lt;SPAN class="VIiyi"&gt;&lt;SPAN class="JLqJ4b ChMk0b"&gt;&lt;SPAN&gt;Here is my unfinished search&lt;/SPAN&gt;&lt;/SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;source="test.csv" sourcetype="csv"
| chart count(size) by fruit_type, size&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="VIiyi"&gt;&lt;SPAN class="JLqJ4b ChMk0b"&gt;&lt;SPAN&gt;Thanks for any help&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Sep 2021 06:37:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-counts-of-the-sub-category-items-in-the/m-p/565923#M197193</guid>
      <dc:creator>homer07</dc:creator>
      <dc:date>2021-09-05T06:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort the counts of the sub-category items in the categories?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-counts-of-the-sub-category-items-in-the/m-p/565928#M197197</link>
      <description>&lt;LI-CODE lang="markup"&gt;| stats count by fruit_type size
| sort 0 fruit_type count&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 05 Sep 2021 09:38:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-counts-of-the-sub-category-items-in-the/m-p/565928#M197197</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-09-05T09:38:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort the counts of the sub-category items in the categories?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-counts-of-the-sub-category-items-in-the/m-p/565929#M197198</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/238000"&gt;@homer07&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;let me understand: you want that in each Histogram for each fuit, you have before Small, then Medium and then Big?&lt;/P&gt;&lt;P&gt;This is the sort you want?&lt;/P&gt;&lt;P&gt;If this is your need, use the sort command at the end of your search:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;source="test.csv" sourcetype="csv"
| stats count by fruit_type, size
| soer fruit_type -size&lt;/LI-CODE&gt;&lt;P&gt;In this case it's easy, because the values are in inverse alphabetical order; otherwise you have to use an evall command before the chart adding a number at the start of each value of size, deleting it after the stats command.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Sun, 05 Sep 2021 09:39:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-counts-of-the-sub-category-items-in-the/m-p/565929#M197198</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-09-05T09:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort the counts of the sub-category items in the categories?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-counts-of-the-sub-category-items-in-the/m-p/565930#M197199</link>
      <description>&lt;P&gt;Thank you for your answer, but it is not the result I want. According to your method, in apple’s category, it is sorted ascending, but in melon category, it becomes descending sorting, and I need a consistent sorting in all categories.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Sep 2021 10:12:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-counts-of-the-sub-category-items-in-the/m-p/565930#M197199</guid>
      <dc:creator>homer07</dc:creator>
      <dc:date>2021-09-05T10:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort the counts of the sub-category items in the categories?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-counts-of-the-sub-category-items-in-the/m-p/565931#M197200</link>
      <description>&lt;P&gt;Thank you for your answer, it is the result I want.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Sep 2021 10:14:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-counts-of-the-sub-category-items-in-the/m-p/565931#M197200</guid>
      <dc:creator>homer07</dc:creator>
      <dc:date>2021-09-05T10:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort the counts of the sub-category items in the categories?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-counts-of-the-sub-category-items-in-the/m-p/565975#M197217</link>
      <description>&lt;P&gt;If I want to sort the results of the chart, what should I do?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Sep 2021 06:19:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-counts-of-the-sub-category-items-in-the/m-p/565975#M197217</guid>
      <dc:creator>homer07</dc:creator>
      <dc:date>2021-09-06T06:19:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort the counts of the sub-category items in the categories?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-counts-of-the-sub-category-items-in-the/m-p/565981#M197221</link>
      <description>&lt;P&gt;The chart will display the bars in the same order as the columns in the table generated by the chart or xyseries command - this is usually lexicographical - You can transpose the table, sort the rows by some criteria (here I have used the length of the word for the size), then transpose it back.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="fruit_type,size
apple,big
banana,medium
melon,small
banana,small
apple,small
apple,small
apple,medium
melon,big
melon,big
melon,big"
| multikv forceheader=1
| table fruit_type size
| stats count by fruit_type size
| sort 0 fruit_type -count
| xyseries fruit_type size count
| transpose 0 header_field=fruit_type column_name=size
| eval width=len(size)
| sort - width
| fields - width
| transpose 0 header_field=size column_name=fruit_type&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 06 Sep 2021 07:53:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-counts-of-the-sub-category-items-in-the/m-p/565981#M197221</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-09-06T07:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort the counts of the sub-category items in the categories?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-counts-of-the-sub-category-items-in-the/m-p/566045#M197236</link>
      <description>&lt;P&gt;Thanks again! In addition, if I want to change "| eval width=len(size)" to "| eval width=count(size)", is it more difficult? Is there other way to replace the effect of chart command?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2021 00:09:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-counts-of-the-sub-category-items-in-the/m-p/566045#M197236</guid>
      <dc:creator>homer07</dc:creator>
      <dc:date>2021-09-07T00:09:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort the counts of the sub-category items in the categories?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-counts-of-the-sub-category-items-in-the/m-p/566071#M197250</link>
      <description>&lt;P&gt;The eval you suggested doesn't do what you might think. What is it that you are trying to achieve?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2021 07:24:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-counts-of-the-sub-category-items-in-the/m-p/566071#M197250</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-09-07T07:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort the counts of the sub-category items in the categories?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-counts-of-the-sub-category-items-in-the/m-p/566098#M197263</link>
      <description>&lt;P&gt;Your method is to calculate the length for different sizes (small, medium, big). What if I want to count the numbers of different sizes? What should I do?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2021 09:06:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-counts-of-the-sub-category-items-in-the/m-p/566098#M197263</guid>
      <dc:creator>homer07</dc:creator>
      <dc:date>2021-09-07T09:06:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort the counts of the sub-category items in the categories?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-counts-of-the-sub-category-items-in-the/m-p/566099#M197264</link>
      <description>&lt;P&gt;I am not sure what you are asking for. There are 3 different sizes. Do you simply want the count of how many different sizes were used by fruit_type regardless of how many events there were? Perhaps you could give an example of the desired result (at least in table form) so I can better understand what you are trying to do&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2021 09:11:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-counts-of-the-sub-category-items-in-the/m-p/566099#M197264</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-09-07T09:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort the counts of the sub-category items in the categories?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-counts-of-the-sub-category-items-in-the/m-p/566237#M197341</link>
      <description>&lt;P&gt;Thanks again.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Sep 2021 02:41:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-the-counts-of-the-sub-category-items-in-the/m-p/566237#M197341</guid>
      <dc:creator>homer07</dc:creator>
      <dc:date>2021-09-08T02:41:28Z</dc:date>
    </item>
  </channel>
</rss>

