<?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 total when using eval case to create chart? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-sort-total-when-using-eval-case-to-create-chart/m-p/616558#M50625</link>
    <description>&lt;P&gt;Add this to the end of your query:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| addtotals | sort - Total | fields - Total&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 10 Oct 2022 16:54:57 GMT</pubDate>
    <dc:creator>johnhuang</dc:creator>
    <dc:date>2022-10-10T16:54:57Z</dc:date>
    <item>
      <title>How to sort total when using eval case to create chart?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-sort-total-when-using-eval-case-to-create-chart/m-p/616538#M50622</link>
      <description>&lt;P&gt;I have the following search that shows the top 10 hosts by count of vulnerability categories:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=foo
| stats count as Count by security_group_name, severity 
| chart useother=true first(Count) over security_group_name by severity 
| eval total=case(critical&amp;gt;0 AND high&amp;gt;0,critical+high,critical&amp;gt;0,critical,high&amp;gt;0,high,1==1,0) 
| eval subTotal=case(medium&amp;gt;0 AND low&amp;gt;0,medium+low,medium&amp;gt;0,medium,low&amp;gt;0,low,1==1,0) 
| sort 10 - subTotal,subSubTotal,total 
| fields - subTotal,subSubTotal,total
| table "security_group_name",critical,high,medium,low&lt;/LI-CODE&gt;&lt;P&gt;This issue with my chart is that the results are not sorted by the overall total so I see the following results:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="splunk chart.JPG" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/21961i5AA410813AF5D6FE/image-size/large?v=v2&amp;amp;px=999" role="button" title="splunk chart.JPG" alt="splunk chart.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;How do I modify my search to sort by overall count/total?&lt;/P&gt;&lt;P&gt;Thx&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2022 14:49:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-sort-total-when-using-eval-case-to-create-chart/m-p/616538#M50622</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2022-10-10T14:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort total when using eval case to create chart?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-sort-total-when-using-eval-case-to-create-chart/m-p/616558#M50625</link>
      <description>&lt;P&gt;Add this to the end of your query:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| addtotals | sort - Total | fields - Total&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 10 Oct 2022 16:54:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-sort-total-when-using-eval-case-to-create-chart/m-p/616558#M50625</guid>
      <dc:creator>johnhuang</dc:creator>
      <dc:date>2022-10-10T16:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort total when using eval case to create chart?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-sort-total-when-using-eval-case-to-create-chart/m-p/616574#M50627</link>
      <description>&lt;P&gt;TYVM as that solved the issue - I was messing around with the | addtotals command but just had it in the wrong place&lt;/P&gt;&lt;P&gt;Thx again!&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2022 20:53:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-sort-total-when-using-eval-case-to-create-chart/m-p/616574#M50627</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2022-10-10T20:53:27Z</dc:date>
    </item>
  </channel>
</rss>

