<?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 values on x-axis based on the values of other fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-values-on-x-axis-based-on-the-values-of-other-fields/m-p/415470#M119601</link>
    <description>&lt;P&gt;@bollam &lt;/P&gt;

&lt;P&gt;You can try by retaining order in other field..&lt;/P&gt;

&lt;P&gt;Can you please try this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main 
| eventstats earliest(startTime) as start_time by job
| stats first(totalMB) as total sum(UsedMB) AS a by start_time, job
| eval pct=round((a/total)*100,2)
| table job start_time pct | eval no=1 | accum no | chart avg(pct) as Mem_used values(no) as no by job | sort no | fields - no
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 30 Nov 2018 08:58:46 GMT</pubDate>
    <dc:creator>kamlesh_vaghela</dc:creator>
    <dc:date>2018-11-30T08:58:46Z</dc:date>
    <item>
      <title>How to sort values on x-axis based on the values of other fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-values-on-x-axis-based-on-the-values-of-other-fields/m-p/415469#M119600</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I'm trying to plot a graph based on three fields.&lt;/P&gt;

&lt;P&gt;The events contain the job, startTime, usedMemory. I want to plot a graph based on the start_time(epochTime) of the job.&lt;/P&gt;

&lt;P&gt;I have a query written as follow.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main 
| eventstats earliest(startTime) as start_time by job
| stats first(totalMB) as total sum(UsedMB) AS a by start_time, stage
| eval pct=round((a/total)*100,2)
| table start_time stage pct
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This query is giving me the right results as expected.&lt;/P&gt;

&lt;P&gt;job      start_time      pct&lt;BR /&gt;
b          00:05          20&lt;BR /&gt;
c          00:10          15&lt;BR /&gt;
f          00:25          55&lt;BR /&gt;
a          00:00          40&lt;BR /&gt;
d          00:15          60&lt;/P&gt;

&lt;P&gt;When trying to plot a graph using following query, The job is getting sorted in the ascending order which I do not want.&lt;BR /&gt;
I wanted the way how it is shown above on the x-axis ( b c f a d )&lt;/P&gt;

&lt;P&gt;I need the values on the x-axis how the results with table command.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main 
| eventstats earliest(startTime) as start_time by job
| stats first(totalMB) as total sum(UsedMB) AS a by start_time, job
| eval pct=round((a/total)*100,2)
| table start_time job pct
| chart avg(pct) as Mem_used by job
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Nov 2018 08:43:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-values-on-x-axis-based-on-the-values-of-other-fields/m-p/415469#M119600</guid>
      <dc:creator>bollam</dc:creator>
      <dc:date>2018-11-30T08:43:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort values on x-axis based on the values of other fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-values-on-x-axis-based-on-the-values-of-other-fields/m-p/415470#M119601</link>
      <description>&lt;P&gt;@bollam &lt;/P&gt;

&lt;P&gt;You can try by retaining order in other field..&lt;/P&gt;

&lt;P&gt;Can you please try this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main 
| eventstats earliest(startTime) as start_time by job
| stats first(totalMB) as total sum(UsedMB) AS a by start_time, job
| eval pct=round((a/total)*100,2)
| table job start_time pct | eval no=1 | accum no | chart avg(pct) as Mem_used values(no) as no by job | sort no | fields - no
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Nov 2018 08:58:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-values-on-x-axis-based-on-the-values-of-other-fields/m-p/415470#M119601</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2018-11-30T08:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort values on x-axis based on the values of other fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-values-on-x-axis-based-on-the-values-of-other-fields/m-p/415471#M119602</link>
      <description>&lt;P&gt;@kamlesh_vaghela, Thanks much!! It worked&lt;/P&gt;</description>
      <pubDate>Mon, 03 Dec 2018 06:41:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-values-on-x-axis-based-on-the-values-of-other-fields/m-p/415471#M119602</guid>
      <dc:creator>bollam</dc:creator>
      <dc:date>2018-12-03T06:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to sort values on x-axis based on the values of other fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-sort-values-on-x-axis-based-on-the-values-of-other-fields/m-p/415472#M119603</link>
      <description>&lt;P&gt;@bollam&lt;/P&gt;

&lt;P&gt;Glad to help you. Can you please accept the answer to help the community.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Happy Splunking&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Dec 2018 12:51:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-sort-values-on-x-axis-based-on-the-values-of-other-fields/m-p/415472#M119603</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2018-12-03T12:51:33Z</dc:date>
    </item>
  </channel>
</rss>

