<?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 Toggle Ascending/Descending in sort order dynamically in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Toggle-Ascending-Descending-in-sort-order-dynamically/m-p/1415937#M427735</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've got a variable vToggleSortOrder that has the default value of 0. By pressing a button it changes to 1 if 0 and back to 0 if 1. I've got an expression that dynamically changes the sort order depending on the variable. However, I would need to to have it be Ascending in one scenario and Descending in the other, is this possible? Or do I somehow have to manipulate the results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorting is either in starting time HH:MM:SS or interval in time between two dates HH:MM:SS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/173659_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 17 Aug 2017 08:41:41 GMT</pubDate>
    <dc:creator />
    <dc:date>2017-08-17T08:41:41Z</dc:date>
    <item>
      <title>Toggle Ascending/Descending in sort order dynamically</title>
      <link>https://community.qlik.com/t5/QlikView/Toggle-Ascending-Descending-in-sort-order-dynamically/m-p/1415937#M427735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've got a variable vToggleSortOrder that has the default value of 0. By pressing a button it changes to 1 if 0 and back to 0 if 1. I've got an expression that dynamically changes the sort order depending on the variable. However, I would need to to have it be Ascending in one scenario and Descending in the other, is this possible? Or do I somehow have to manipulate the results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorting is either in starting time HH:MM:SS or interval in time between two dates HH:MM:SS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/173659_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Aug 2017 08:41:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Toggle-Ascending-Descending-in-sort-order-dynamically/m-p/1415937#M427735</guid>
      <dc:creator />
      <dc:date>2017-08-17T08:41:41Z</dc:date>
    </item>
    <item>
      <title>Re: Toggle Ascending/Descending in sort order dynamically</title>
      <link>https://community.qlik.com/t5/QlikView/Toggle-Ascending-Descending-in-sort-order-dynamically/m-p/1415938#M427736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Solved it by incapsuling my expression in a rank() function and it works &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=if(vToggleSortOrder=1, &lt;STRONG&gt;Rank(&lt;/STRONG&gt;Interval(Max({&amp;lt;[Date] = {'$(=DATE($(varDateSelect)))'}, [LAST_RUN_ORDER] = {'= Min({$&amp;lt;Date = {"=$(=Date($(varDateSelect)))"}&amp;gt;} LAST_RUN_ORDER)'}&amp;gt;} Time([ACC_END]))-Min({&amp;lt;[Date] = {'$(=DATE($(varDateSelect)))'}, [LAST_RUN_ORDER] = {'= Min({$&amp;lt;Date = {"=$(=Date($(varDateSelect)))"}&amp;gt;} LAST_RUN_ORDER)'}&amp;gt;} Time([ACC_START])))&lt;STRONG&gt;)&lt;/STRONG&gt;,Min({$&amp;lt;[Date] = {'$(=DATE($(varMaxDate)))'}, [LAST_RUN_ORDER] = {"1"}&amp;gt;}Time([ACC_START])))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Aug 2017 08:58:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Toggle-Ascending-Descending-in-sort-order-dynamically/m-p/1415938#M427736</guid>
      <dc:creator />
      <dc:date>2017-08-17T08:58:52Z</dc:date>
    </item>
  </channel>
</rss>

