<?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: sort bars in a chart so that Yesterday's bar is on the left of Today's bar for each value of &amp;quot;over&amp;quot; field in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/sort-bars-in-a-chart-so-that-Yesterday-s-bar-is-on-the-left-of/m-p/492322#M32258</link>
    <description>&lt;P&gt;Thank you, that's clever, will keep that in mind. &lt;BR /&gt;
I accepted niketnilay's answer because it was first. In the end I did not use &lt;CODE&gt;rename&lt;/CODE&gt;  but used &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| table, id, Yesterday, Today
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 17 Mar 2020 19:26:23 GMT</pubDate>
    <dc:creator>nickrally2009</dc:creator>
    <dc:date>2020-03-17T19:26:23Z</dc:date>
    <item>
      <title>sort bars in a chart so that Yesterday's bar is on the left of Today's bar for each value of "over" field</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/sort-bars-in-a-chart-so-that-Yesterday-s-bar-is-on-the-left-of/m-p/492318#M32254</link>
      <description>&lt;P&gt;I have this search, and it works correctly:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; source=foo resource=bar earliest=-1d@d latest=now
 | eval Day=if(_time&amp;lt;relative_time(now(),"@d"),"Yesterday","Today")
 | rex max_match=0 "(?:'id': )(?P&amp;lt;id&amp;gt;[^,]+)|(?:'usage': )(?P&amp;lt;usage&amp;gt;[^,]+)"
 | chart max(usage) over id by Day | where Yesterday!=Today | sort Today
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It shows Today's bar on the left of Yesterday's bar for each id. I tried to reverse the order, to show Yesterday's bar on the left of Today's bar for each id, but did not find a way to make it work unless I rename the column(s), e.g. rename "Yesterday" to "Before" and rename "Today" to "Now". It appears that the default behavior is to sort in alphabetical order. Is there a better way to do this? &lt;BR /&gt;
Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 16 Mar 2020 18:31:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/sort-bars-in-a-chart-so-that-Yesterday-s-bar-is-on-the-left-of/m-p/492318#M32254</guid>
      <dc:creator>nickrally2009</dc:creator>
      <dc:date>2020-03-16T18:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: sort bars in a chart so that Yesterday's bar is on the left of Today's bar for each value of "over" field</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/sort-bars-in-a-chart-so-that-Yesterday-s-bar-is-on-the-left-of/m-p/492319#M32255</link>
      <description>&lt;P&gt;Try the following.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   source=foo resource=bar earliest=-1d@d latest=now
  | eval Day=if(_time&amp;lt;relative_time(now(),"@d"),"1.Yesterday","2.Today")
  | rex max_match=0 "(?:'id': )(?P&amp;lt;id&amp;gt;[^,]+)|(?:'usage': )(?P&amp;lt;usage&amp;gt;[^,]+)"
  | chart max(usage) over id by Day 
  | where "1.Yesterday"!="2.Today"
  | rename "1.Yesterday" as "Yesterday" "2.Today" as Today
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Mar 2020 05:18:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/sort-bars-in-a-chart-so-that-Yesterday-s-bar-is-on-the-left-of/m-p/492319#M32255</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-03-17T05:18:13Z</dc:date>
    </item>
    <item>
      <title>Re: sort bars in a chart so that Yesterday's bar is on the left of Today's bar for each value of "over" field</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/sort-bars-in-a-chart-so-that-Yesterday-s-bar-is-on-the-left-of/m-p/492320#M32256</link>
      <description>&lt;P&gt;Thank you @niketnilay . I used &lt;CODE&gt;Before&lt;/CODE&gt; and &lt;CODE&gt;Now&lt;/CODE&gt; instead of &lt;CODE&gt;Yesterday&lt;/CODE&gt; and &lt;CODE&gt;Today&lt;/CODE&gt; respectively as an alternative to renaming, hoped there is a &lt;CODE&gt;sort&lt;/CODE&gt; variation that could reverse the order instead of renaming. &lt;BR /&gt;
There is also another way: &lt;CODE&gt;| table, id, Yesterday, Today&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Mar 2020 14:49:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/sort-bars-in-a-chart-so-that-Yesterday-s-bar-is-on-the-left-of/m-p/492320#M32256</guid>
      <dc:creator>nickrally2009</dc:creator>
      <dc:date>2020-03-17T14:49:49Z</dc:date>
    </item>
    <item>
      <title>Re: sort bars in a chart so that Yesterday's bar is on the left of Today's bar for each value of "over" field</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/sort-bars-in-a-chart-so-that-Yesterday-s-bar-is-on-the-left-of/m-p/492321#M32257</link>
      <description>&lt;P&gt;Add this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rename Yesterday AS " Yesterday"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Adding the space will re-order the fields but be invisible.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Mar 2020 17:16:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/sort-bars-in-a-chart-so-that-Yesterday-s-bar-is-on-the-left-of/m-p/492321#M32257</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2020-03-17T17:16:57Z</dc:date>
    </item>
    <item>
      <title>Re: sort bars in a chart so that Yesterday's bar is on the left of Today's bar for each value of "over" field</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/sort-bars-in-a-chart-so-that-Yesterday-s-bar-is-on-the-left-of/m-p/492322#M32258</link>
      <description>&lt;P&gt;Thank you, that's clever, will keep that in mind. &lt;BR /&gt;
I accepted niketnilay's answer because it was first. In the end I did not use &lt;CODE&gt;rename&lt;/CODE&gt;  but used &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| table, id, Yesterday, Today
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Mar 2020 19:26:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/sort-bars-in-a-chart-so-that-Yesterday-s-bar-is-on-the-left-of/m-p/492322#M32258</guid>
      <dc:creator>nickrally2009</dc:creator>
      <dc:date>2020-03-17T19:26:23Z</dc:date>
    </item>
    <item>
      <title>Re: sort bars in a chart so that Yesterday's bar is on the left of Today's bar for each value of "over" field</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/sort-bars-in-a-chart-so-that-Yesterday-s-bar-is-on-the-left-of/m-p/492323#M32259</link>
      <description>&lt;P&gt;Curses, foiled again!  Thanks for the &lt;CODE&gt;UpVote&lt;/CODE&gt;! &lt;span class="lia-unicode-emoji" title=":grinning_squinting_face:"&gt;😆&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Mar 2020 22:57:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/sort-bars-in-a-chart-so-that-Yesterday-s-bar-is-on-the-left-of/m-p/492323#M32259</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2020-03-17T22:57:45Z</dc:date>
    </item>
  </channel>
</rss>

