<?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: Sorting timechart fields by field value in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Sorting-timechart-fields-by-field-value/m-p/689165#M56447</link>
    <description>&lt;P&gt;There is also two pure search versions which are very ugly&lt;/P&gt;&lt;P&gt;Assuming this is a base search that creates the timechart&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults count=3600 
| streamstats c 
| eval _time=relative_time(now(), "@m") - c 
| eval type=mvindex(split("Budgeting,General Ledger,Payables,Expenses,eProcurement,Purchasing",","), random() % 6) 
| timechart fixedrange=f span=1m count by type &lt;/LI-CODE&gt;&lt;P&gt;then this version does a double transpose - the good thing about the double transpose is that it does not change the column order on the second transpose - however it does require that you know the sort column number - although you could work that out in a separate dashboard search&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| transpose 0
| sort - "row 60"
| transpose 0 header_field=column
| fields - column&lt;/LI-CODE&gt;&lt;P&gt;this version uses a mechanism to get the column names, sort them and then prefix the column with a numeric which will cause the columns to be ordered correctly, however, you can't rename them back as Splunk will then reorder alphabetically.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| appendpipe [
  | stats latest(*) as *
  | transpose 0
  | sort - "row 1"
  | streamstats c
  | eval name="_".c."_".column
  | fields name
]
| eventstats values(name) as _name
| fields - name
| foreach * [ eval f=mvindex(_name, mvfind(_name, "&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;")), f=replace(f, "^_", ""), {f}='&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;' | fields - "&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;" ]
| fields - f
| where isnotnull(_time)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 31 May 2024 06:27:16 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2024-05-31T06:27:16Z</dc:date>
    <item>
      <title>Sorting timechart fields by field value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Sorting-timechart-fields-by-field-value/m-p/689145#M56445</link>
      <description>&lt;P&gt;I would like to visualize using the Single Value visualization with and Trellis Layout and sort panels by the value of the latest field in the BY clause.&amp;nbsp; I can follow the timechart with a table and order the rows manually, but I would like something more automatic.&lt;BR /&gt;&lt;BR /&gt;Is there a way of specifying a field projection order via some sort of sort that can be used with timechart. I can't seem to find anything and may need to rely upon something that is an outside the box.&lt;/P&gt;&lt;P&gt;Please advise,&lt;BR /&gt;Tim&lt;/P&gt;&lt;P&gt;Here is my SPL and the resulting visualization below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;| mstats latest(_value) as value
         WHERE index="my_metrics" 
         AND metric_name="my.app.metric.count"
         BY group
         span=15m
| timechart span=15m usenull=false useother=false partial=false
         sum(value) AS count
         BY group
         WHERE max in top6&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-05-30 at 4.38.43 PM.png" style="width: 774px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/31086i2BF186016C3A6CA1/image-dimensions/774x89?v=v2" width="774" height="89" role="button" title="Screenshot 2024-05-30 at 4.38.43 PM.png" alt="Screenshot 2024-05-30 at 4.38.43 PM.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Screenshot 2024-05-30 at 4.49.26 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/31087i3184E7E9B954D526/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-05-30 at 4.49.26 PM.png" alt="Screenshot 2024-05-30 at 4.49.26 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2024 21:53:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Sorting-timechart-fields-by-field-value/m-p/689145#M56445</guid>
      <dc:creator>peiffer</dc:creator>
      <dc:date>2024-05-30T21:53:13Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting timechart fields by field value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Sorting-timechart-fields-by-field-value/m-p/689160#M56446</link>
      <description>&lt;P&gt;There are a couple of ways (at least) to do this&lt;/P&gt;&lt;P&gt;Here is an example dashboard - that shows three techniques.&lt;/P&gt;&lt;P&gt;1. Uses a token in a base search to define the sort order as a token ($sort_order$) - there is an annoying issue with this method, which means that once the trellis is shown with the order, it will NOT reorder the trellis if the underlying table order changes.&lt;/P&gt;&lt;P&gt;2. Uses 6 separate single panels aligned horizontally and six tokens that define the display for the viz. ($f0$ to $f5$). This re-orders on change&lt;/P&gt;&lt;P&gt;3. Uses&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/121148"&gt;@chrisyounger&lt;/a&gt;&amp;nbsp;number set viz -&amp;nbsp;&lt;A href="https://splunkbase.splunk.com/app/4537" target="_blank"&gt;https://splunkbase.splunk.com/app/4537&lt;/A&gt;&amp;nbsp;which will do all this for you and does not require tokens and will re-order when things change&lt;/P&gt;&lt;P&gt;There is possibly a search way directly to do it (appendpipe...?), but with the dashboard, it's pretty simple&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;dashboard version="1.1" theme="light"&amp;gt;
  &amp;lt;label&amp;gt;Sort_TC&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table depends="$hidden$"&amp;gt;
        &amp;lt;search id="base"&amp;gt;
          &amp;lt;query&amp;gt;
| makeresults count=3600 
| streamstats c 
| eval _time=relative_time(now(), "@m") - c 
| eval type=mvindex(split("Budgeting,General Ledger,Payables,Expenses,eProcurement,Purchasing",","), random() % 6) 
| timechart fixedrange=f span=1m count by type
          &amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-60m@m&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
          &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="count"&amp;gt;100&amp;lt;/option&amp;gt;
        &amp;lt;option name="dataOverlayMode"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="percentagesRow"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
        &amp;lt;option name="rowNumbers"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="totalsRow"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="wrap"&amp;gt;true&amp;lt;/option&amp;gt;
      &amp;lt;/table&amp;gt;
      &amp;lt;table depends="hidden$"&amp;gt;
        &amp;lt;title&amp;gt;Sorting order is $sort_order$&amp;lt;/title&amp;gt;
        &amp;lt;search base="base"&amp;gt;
          &amp;lt;done&amp;gt;
            &amp;lt;set token="sort_order"&amp;gt;$result.sort$&amp;lt;/set&amp;gt;
            &amp;lt;set token="f0"&amp;gt;$result.f0$&amp;lt;/set&amp;gt;
            &amp;lt;set token="f1"&amp;gt;$result.f1$&amp;lt;/set&amp;gt;
            &amp;lt;set token="f2"&amp;gt;$result.f2$&amp;lt;/set&amp;gt;
            &amp;lt;set token="f3"&amp;gt;$result.f3$&amp;lt;/set&amp;gt;
            &amp;lt;set token="f4"&amp;gt;$result.f4$&amp;lt;/set&amp;gt;
            &amp;lt;set token="f5"&amp;gt;$result.f5$&amp;lt;/set&amp;gt;
          &amp;lt;/done&amp;gt;
          &amp;lt;query&amp;gt;| tail 1
| fields - _span _time
| transpose 0
| sort - "row 1"
| stats list(column) as sort list("row 1") as counts
| foreach 0 1 2 3 4 5 [ eval f&amp;amp;lt;&amp;amp;lt;FIELD&amp;amp;gt;&amp;amp;gt;=mvindex(sort, &amp;amp;lt;&amp;amp;lt;FIELD&amp;amp;gt;&amp;amp;gt;) ]
| eval sort="\"".mvjoin(sort, "\" \"")."\""&amp;lt;/query&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="count"&amp;gt;100&amp;lt;/option&amp;gt;
        &amp;lt;option name="dataOverlayMode"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="percentagesRow"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
        &amp;lt;option name="rowNumbers"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="totalsRow"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="wrap"&amp;gt;true&amp;lt;/option&amp;gt;
      &amp;lt;/table&amp;gt;
      &amp;lt;single&amp;gt;
        &amp;lt;search base="base"&amp;gt;
          &amp;lt;query&amp;gt;| table _time $sort_order$&amp;lt;/query&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="colorMode"&amp;gt;block&amp;lt;/option&amp;gt;
        &amp;lt;option name="rangeColors"&amp;gt;["0x53a051","0x0877a6","0xf8be34","0xf1813f","0xdc4e41"]&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.enabled"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="useColors"&amp;gt;1&amp;lt;/option&amp;gt;
      &amp;lt;/single&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;single&amp;gt;
        &amp;lt;title&amp;gt;$f0$&amp;lt;/title&amp;gt;
        &amp;lt;search base="base"&amp;gt;
          &amp;lt;query&amp;gt;
| table _time $f0|s$            
          &amp;lt;/query&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="colorMode"&amp;gt;block&amp;lt;/option&amp;gt;
        &amp;lt;option name="rangeColors"&amp;gt;["0x53a051","0x0877a6","0xf8be34","0xf1813f","0xdc4e41"]&amp;lt;/option&amp;gt;
        &amp;lt;option name="useColors"&amp;gt;1&amp;lt;/option&amp;gt;
      &amp;lt;/single&amp;gt;
      &amp;lt;single&amp;gt;
        &amp;lt;title&amp;gt;$f1$&amp;lt;/title&amp;gt;
        &amp;lt;search base="base"&amp;gt;
          &amp;lt;query&amp;gt;
| table _time $f1|s$            
          &amp;lt;/query&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="colorMode"&amp;gt;block&amp;lt;/option&amp;gt;
        &amp;lt;option name="rangeColors"&amp;gt;["0x53a051","0x0877a6","0xf8be34","0xf1813f","0xdc4e41"]&amp;lt;/option&amp;gt;
        &amp;lt;option name="useColors"&amp;gt;1&amp;lt;/option&amp;gt;
      &amp;lt;/single&amp;gt;
      &amp;lt;single&amp;gt;
        &amp;lt;title&amp;gt;$f2$&amp;lt;/title&amp;gt;
        &amp;lt;search base="base"&amp;gt;
          &amp;lt;query&amp;gt;
| table _time $f2|s$           
          &amp;lt;/query&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="colorMode"&amp;gt;block&amp;lt;/option&amp;gt;
        &amp;lt;option name="rangeColors"&amp;gt;["0x53a051","0x0877a6","0xf8be34","0xf1813f","0xdc4e41"]&amp;lt;/option&amp;gt;
        &amp;lt;option name="useColors"&amp;gt;1&amp;lt;/option&amp;gt;
      &amp;lt;/single&amp;gt;
      &amp;lt;single&amp;gt;
        &amp;lt;title&amp;gt;$f3$&amp;lt;/title&amp;gt;
        &amp;lt;search base="base"&amp;gt;
          &amp;lt;query&amp;gt;
| table _time $f3|s$            
          &amp;lt;/query&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="colorMode"&amp;gt;block&amp;lt;/option&amp;gt;
        &amp;lt;option name="rangeColors"&amp;gt;["0x53a051","0x0877a6","0xf8be34","0xf1813f","0xdc4e41"]&amp;lt;/option&amp;gt;
        &amp;lt;option name="useColors"&amp;gt;1&amp;lt;/option&amp;gt;
      &amp;lt;/single&amp;gt;
      &amp;lt;single&amp;gt;
        &amp;lt;title&amp;gt;$f4$&amp;lt;/title&amp;gt;
        &amp;lt;search base="base"&amp;gt;
          &amp;lt;query&amp;gt;
| table _time $f4|s$            
          &amp;lt;/query&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="colorMode"&amp;gt;block&amp;lt;/option&amp;gt;
        &amp;lt;option name="rangeColors"&amp;gt;["0x53a051","0x0877a6","0xf8be34","0xf1813f","0xdc4e41"]&amp;lt;/option&amp;gt;
        &amp;lt;option name="useColors"&amp;gt;1&amp;lt;/option&amp;gt;
      &amp;lt;/single&amp;gt;
      &amp;lt;single&amp;gt;
        &amp;lt;title&amp;gt;$f5$&amp;lt;/title&amp;gt;
        &amp;lt;search base="base"&amp;gt;
          &amp;lt;query&amp;gt;
| table _time $f5|s$            
          &amp;lt;/query&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="colorMode"&amp;gt;block&amp;lt;/option&amp;gt;
        &amp;lt;option name="rangeColors"&amp;gt;["0x53a051","0x0877a6","0xf8be34","0xf1813f","0xdc4e41"]&amp;lt;/option&amp;gt;
        &amp;lt;option name="useColors"&amp;gt;1&amp;lt;/option&amp;gt;
      &amp;lt;/single&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;viz type="number_set_viz.number_set_viz"&amp;gt;
        &amp;lt;search base="base"&amp;gt;
          &amp;lt;query&amp;gt;
| stats sparkline(max(*)) as sparkline_* latest(*) as * 
| appendpipe [
  | foreach sparkline_* [ eval &amp;amp;lt;&amp;amp;lt;MATCHSTR&amp;amp;gt;&amp;amp;gt;='&amp;amp;lt;&amp;amp;lt;FIELD&amp;amp;gt;&amp;amp;gt;']
]
| fields - sparkline_*
| transpose 0
| rename "row 1" as value, column as title "row 2"  as sparkline
| sort - value
          &amp;lt;/query&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
      &amp;lt;/viz&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2024 03:37:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Sorting-timechart-fields-by-field-value/m-p/689160#M56446</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-05-31T03:37:38Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting timechart fields by field value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Sorting-timechart-fields-by-field-value/m-p/689165#M56447</link>
      <description>&lt;P&gt;There is also two pure search versions which are very ugly&lt;/P&gt;&lt;P&gt;Assuming this is a base search that creates the timechart&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults count=3600 
| streamstats c 
| eval _time=relative_time(now(), "@m") - c 
| eval type=mvindex(split("Budgeting,General Ledger,Payables,Expenses,eProcurement,Purchasing",","), random() % 6) 
| timechart fixedrange=f span=1m count by type &lt;/LI-CODE&gt;&lt;P&gt;then this version does a double transpose - the good thing about the double transpose is that it does not change the column order on the second transpose - however it does require that you know the sort column number - although you could work that out in a separate dashboard search&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| transpose 0
| sort - "row 60"
| transpose 0 header_field=column
| fields - column&lt;/LI-CODE&gt;&lt;P&gt;this version uses a mechanism to get the column names, sort them and then prefix the column with a numeric which will cause the columns to be ordered correctly, however, you can't rename them back as Splunk will then reorder alphabetically.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| appendpipe [
  | stats latest(*) as *
  | transpose 0
  | sort - "row 1"
  | streamstats c
  | eval name="_".c."_".column
  | fields name
]
| eventstats values(name) as _name
| fields - name
| foreach * [ eval f=mvindex(_name, mvfind(_name, "&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;")), f=replace(f, "^_", ""), {f}='&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;' | fields - "&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;" ]
| fields - f
| where isnotnull(_time)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2024 06:27:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Sorting-timechart-fields-by-field-value/m-p/689165#M56447</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-05-31T06:27:16Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting timechart fields by field value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Sorting-timechart-fields-by-field-value/m-p/689170#M56448</link>
      <description>&lt;P&gt;I would rather have a straight search SPL solution, to drive the Trellis layout&lt;BR /&gt;&lt;BR /&gt;The proposed solutions I have seen have the effect of sorting the resulting &lt;FONT color="#999999"&gt;| timechart&lt;/FONT&gt; fields by name rather than by value.&amp;nbsp; The goal is sort by field value.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I appreciate the attempt so far.&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2024 07:39:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Sorting-timechart-fields-by-field-value/m-p/689170#M56448</guid>
      <dc:creator>peiffer</dc:creator>
      <dc:date>2024-05-31T07:39:11Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting timechart fields by field value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Sorting-timechart-fields-by-field-value/m-p/689171#M56449</link>
      <description>&lt;P&gt;These all sort by field value of the last time value of the timechart, they are not sorting by name - what makes you think that?&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2024 07:57:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Sorting-timechart-fields-by-field-value/m-p/689171#M56449</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-05-31T07:57:25Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting timechart fields by field value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Sorting-timechart-fields-by-field-value/m-p/689198#M56454</link>
      <description>&lt;P&gt;I re-implemented your solutions and found #2 sorted by name.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-05-31 at 4.39.05 AM.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/31092iEA28002849D4E291/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-05-31 at 4.39.05 AM.png" alt="Screenshot 2024-05-31 at 4.39.05 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-05-31 at 4.39.18 AM.png" style="width: 396px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/31093i0F651C8EA82800EB/image-dimensions/396x60?v=v2" width="396" height="60" role="button" title="Screenshot 2024-05-31 at 4.39.18 AM.png" alt="Screenshot 2024-05-31 at 4.39.18 AM.png" /&gt;&lt;/span&gt;&lt;BR /&gt;Your solution #3 does indeed sort by value.&amp;nbsp; There is a limitation of 9 or less fields/columns due lexical sorting, and the fields now have additional ##_ prepended.&amp;nbsp; The limitation of 9 or less is significant if you watch a couple of dozen items and rank them.&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-05-31 at 7.20.54 AM.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/31094i7815DF7D2FCBE76E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-05-31 at 7.20.54 AM.png" alt="Screenshot 2024-05-31 at 7.20.54 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-05-31 at 7.22.37 AM.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/31095iF7E4A5F02F717F5C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2024-05-31 at 7.22.37 AM.png" alt="Screenshot 2024-05-31 at 7.22.37 AM.png" /&gt;&lt;/span&gt;&lt;BR /&gt;I will accept the answer.&amp;nbsp; I am thinking there is a simpler subsearch to drive the &lt;FONT color="#999999"&gt;| table&lt;/FONT&gt; projection of the columns and I will continue to look in that direction.&amp;nbsp; For now, I will probably save as a macro.&lt;BR /&gt;&lt;BR /&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2024 12:32:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Sorting-timechart-fields-by-field-value/m-p/689198#M56454</guid>
      <dc:creator>peiffer</dc:creator>
      <dc:date>2024-05-31T12:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting timechart fields by field value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Sorting-timechart-fields-by-field-value/m-p/689332#M56467</link>
      <description>&lt;P&gt;Number 2 does not do sorting in the table itself, that is simply used as the base search in the dashboard to drive the sorting of the visualisation panels, which is what I understood you wanted to do.&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is no practical column limit to the prefix solution, you just need to make the prefix fit the requirement, i.e. change the&amp;nbsp;&lt;STRONG&gt;| eval name=...&lt;/STRONG&gt; to&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;| eval name=printf("_%02d_%s", c, column)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;and you will have a sortable 01_xxx 02_yyy syntax.&lt;/P&gt;&lt;P&gt;As for a subsearch, the problem you face is that generally a subsearch runs BEFORE the primary search, so the subsearch cannot generate the structure for the table command as the timechart has not yet run.&lt;/P&gt;&lt;P&gt;The exception to that is the appendpipe subsearch, which runs inline with the primary search, which I gave as an example, however, this subsearch is different in that it is creating new rows so it can't be used to push data into the commands in the existing pipeline.&lt;/P&gt;&lt;P&gt;I did figure out how to do the double transpose without knowing the column count&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| transpose 0
| sort - [ 
  | makeresults earliest=-60m@m latest=@m
  | timechart fixedrange=t count
  | stats count as row
  | eval search="row ".row
  | format "" "" "" "" "" ""
  ]
| transpose 0 header_field=column
| fields - column&lt;/LI-CODE&gt;&lt;P&gt;the earliest/latest may not be needed in the real world, as long as the timechart and time range matches the outer search, it will get the same row count, so the sort will work with correct column name.&lt;/P&gt;&lt;P&gt;If you do find another way, please post here - it's an interesting SPL challenge.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2024 00:27:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Sorting-timechart-fields-by-field-value/m-p/689332#M56467</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-06-03T00:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting timechart fields by field value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Sorting-timechart-fields-by-field-value/m-p/689452#M56489</link>
      <description>&lt;P&gt;I was batting around the double transpose method with a peer and got a minor variation to work regardless of whether I was throwing the top5 or top40 at it.&amp;nbsp; And it doesn't muck with the column names.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Given the simplicity, I think I am going to drop the idea of going after a table subsearch following the timechart.&amp;nbsp; &amp;nbsp;There is no need since the double transpose method is clean and elegant.&lt;BR /&gt;&lt;BR /&gt;Thank you for the suggestion and the follow ups.&lt;BR /&gt;Tim&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|fields - _span*
|transpose 
|sort - "row 5" ```uses values from the last row (latest time) ```
|transpose header_field="column" 0
|fields - column




&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2024 20:11:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Sorting-timechart-fields-by-field-value/m-p/689452#M56489</guid>
      <dc:creator>peiffer</dc:creator>
      <dc:date>2024-06-03T20:11:33Z</dc:date>
    </item>
  </channel>
</rss>

