<?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 quarterly dates in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Sorting-quarterly-dates/m-p/961461#M13774</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In this case you needs to split your quarter-field with string-functions like in this example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dual(Quarter, num(mid(Quarter, 4)) * 10 + num(mid(Quarter, 2, 1))) as Quarter&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and you could generate a date,too:&lt;/P&gt;&lt;P&gt;makedate(num(mid(Quarter, 4)), num(mid(Quarter, 2, 1)) * 3 - 2) as Date // first date in quarter&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 01 Oct 2015 01:13:21 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2015-10-01T01:13:21Z</dc:date>
    <item>
      <title>Sorting quarterly dates</title>
      <link>https://community.qlik.com/t5/App-Development/Sorting-quarterly-dates/m-p/961458#M13771</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am presented with dates in the form of Q1 2014, Q2 2014, etc. When covering multiple years the sorting in Qlik Sense does not give me the order by year. I have read some other posts on sorting and the suggestion has been to use the Dual function but I can't find very much documentation that shows how to deal with this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Referring to the image you can see how Q2 2015 is out of sequence. Any suggestions are very much appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="2015-09-29_14-03-32.jpg" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/100395_2015-09-29_14-03-32.jpg" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2015 20:10:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Sorting-quarterly-dates/m-p/961458#M13771</guid>
      <dc:creator />
      <dc:date>2015-09-29T20:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting quarterly dates</title>
      <link>https://community.qlik.com/t5/App-Development/Sorting-quarterly-dates/m-p/961459#M13772</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not sure if you could use sorting-expressions within qlik sense but if and you have connected various period-fields (maybe within a master-calendar, here you find many informations about this approach: &lt;A href="https://community.qlik.com/docs/DOC-8843"&gt;How to use - Master-Calendar and Date-Values&lt;/A&gt;) you could use something like avg(YourDateField). Otherwise you need to create a dual-field:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax is: dual(StringValue, NumericValue) and in your case maybe this one:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dual(YourQuarterField, Year * 10 + NumericQuarter)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; or if you hadn't such one&lt;/P&gt;&lt;P&gt;dual(YourQuarterField, Year * 10 + ceil(num(month(YourDateField)) / 3))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Sep 2015 10:07:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Sorting-quarterly-dates/m-p/961459#M13772</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2015-09-30T10:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting quarterly dates</title>
      <link>https://community.qlik.com/t5/App-Development/Sorting-quarterly-dates/m-p/961460#M13773</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marcus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks you for replying so quickly. I should have clarified that my date information is formed as a single record in my Excel dump. Columns name is Quarter and each row is represented in the form of Q1 2015. When I try your example in a load script it errors out stating that Year is not found.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm new to scripting so most of this is trial and error for me at this stage. Here is my original script if that sheds any light on what I am attempting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Usage]:&lt;/P&gt;&lt;P&gt;LOAD [Brand],&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Quarter],&lt;/P&gt;&lt;P&gt; [Product],&lt;/P&gt;&lt;P&gt; [Machine Version],&lt;/P&gt;&lt;P&gt; [Ultimate],&lt;/P&gt;&lt;P&gt; [Industry Code],&lt;/P&gt;&lt;P&gt; [Country],&lt;/P&gt;&lt;P&gt; [SELECT Series],&lt;/P&gt;&lt;P&gt; [Sales Channel],&lt;/P&gt;&lt;P&gt; [Sales Rep],&lt;/P&gt;&lt;P&gt; [Unique Machines]&lt;/P&gt;&lt;P&gt;FROM [lib://Dashboard/Plan.xlsx]&lt;/P&gt;&lt;P&gt;(ooxml, embedded labels, table is Usage);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;Ian &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Sep 2015 19:59:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Sorting-quarterly-dates/m-p/961460#M13773</guid>
      <dc:creator />
      <dc:date>2015-09-30T19:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting quarterly dates</title>
      <link>https://community.qlik.com/t5/App-Development/Sorting-quarterly-dates/m-p/961461#M13774</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In this case you needs to split your quarter-field with string-functions like in this example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dual(Quarter, num(mid(Quarter, 4)) * 10 + num(mid(Quarter, 2, 1))) as Quarter&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and you could generate a date,too:&lt;/P&gt;&lt;P&gt;makedate(num(mid(Quarter, 4)), num(mid(Quarter, 2, 1)) * 3 - 2) as Date // first date in quarter&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Oct 2015 01:13:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Sorting-quarterly-dates/m-p/961461#M13774</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2015-10-01T01:13:21Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting quarterly dates</title>
      <link>https://community.qlik.com/t5/App-Development/Sorting-quarterly-dates/m-p/961462#M13775</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much for this Marcus. It worked perfectly. I can see where I can use this in similar situation where I have concatenated data provided to me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Ian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Oct 2015 20:02:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Sorting-quarterly-dates/m-p/961462#M13775</guid>
      <dc:creator />
      <dc:date>2015-10-01T20:02:00Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting quarterly dates</title>
      <link>https://community.qlik.com/t5/App-Development/Sorting-quarterly-dates/m-p/1699255#M53535</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/28038"&gt;@marcus_sommer&lt;/a&gt;&amp;nbsp; Your solution was handy.&lt;/P&gt;&lt;P&gt;Appreciate all the contributors &amp;amp; members of the Qlik community for sharing their knowledge.&lt;/P&gt;&lt;P&gt;Its a very reliable and vast forum having answers to most of the roadblocks for new developers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;Swapneel&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2020 04:48:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Sorting-quarterly-dates/m-p/1699255#M53535</guid>
      <dc:creator>swapneel22</dc:creator>
      <dc:date>2020-05-06T04:48:59Z</dc:date>
    </item>
  </channel>
</rss>

