<?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: Month/Year date field in date sort order in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Month-Year-date-field-in-date-sort-order/m-p/500802#M552816</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My suggestion would be to use MonthName() function in the script to generate real date field with numerical data at the back end. If you prefer to work at the front end, then try using date#() function in the sort tab-&amp;gt;expression, like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Date#(YourMonthYearField, 'MMM-YY')&lt;/P&gt;&lt;P&gt;and then order acs/desc. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 Oct 2013 06:14:49 GMT</pubDate>
    <dc:creator>tresB</dc:creator>
    <dc:date>2013-10-02T06:14:49Z</dc:date>
    <item>
      <title>Month/Year date field in date sort order</title>
      <link>https://community.qlik.com/t5/QlikView/Month-Year-date-field-in-date-sort-order/m-p/500800#M552814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a Month/Year like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Apr-13&lt;/P&gt;&lt;P&gt;Aug-13&lt;/P&gt;&lt;P&gt;Jan-13&lt;/P&gt;&lt;P&gt;Sept-13&lt;/P&gt;&lt;P&gt;etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No matter what I have tried I can't get this to sort in date order. Seems like it should be simple but it keeps doing it alphabetically and sometimes in an order I don't even understand.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, Steve:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Oct 2013 01:45:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Month-Year-date-field-in-date-sort-order/m-p/500800#M552814</guid>
      <dc:creator>zagzebski</dc:creator>
      <dc:date>2013-10-02T01:45:40Z</dc:date>
    </item>
    <item>
      <title>Re: Month/Year date field in date sort order</title>
      <link>https://community.qlik.com/t5/QlikView/Month-Year-date-field-in-date-sort-order/m-p/500801#M552815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi Steve,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you arriving this month dimension from datefield then try like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;*,&lt;/P&gt;&lt;P&gt;Dual(Date(DateFieldName, 'MMM-YY'), MonthEnd(DateFieldName)) AS MonthName&lt;/P&gt;&lt;P&gt;FROM TableName;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now in Sort tab select Number and Asc/Desc as your wish.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Oct 2013 02:14:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Month-Year-date-field-in-date-sort-order/m-p/500801#M552815</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2013-10-02T02:14:13Z</dc:date>
    </item>
    <item>
      <title>Re: Month/Year date field in date sort order</title>
      <link>https://community.qlik.com/t5/QlikView/Month-Year-date-field-in-date-sort-order/m-p/500802#M552816</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My suggestion would be to use MonthName() function in the script to generate real date field with numerical data at the back end. If you prefer to work at the front end, then try using date#() function in the sort tab-&amp;gt;expression, like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Date#(YourMonthYearField, 'MMM-YY')&lt;/P&gt;&lt;P&gt;and then order acs/desc. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Oct 2013 06:14:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Month-Year-date-field-in-date-sort-order/m-p/500802#M552816</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2013-10-02T06:14:49Z</dc:date>
    </item>
    <item>
      <title>Re: Month/Year date field in date sort order</title>
      <link>https://community.qlik.com/t5/QlikView/Month-Year-date-field-in-date-sort-order/m-p/500803#M552817</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;nbsp; LET varMinDate = Num(MakeDate(2001,1,1));&lt;/P&gt;&lt;P&gt;LET varMaxDate = Num(MakeDate(2007,12,31));&lt;/P&gt;&lt;P&gt;LET vToday = Num(today());&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//*************** Temporary Calendar ***************&lt;/P&gt;&lt;P&gt;TempCalendar:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp; $(varMinDate)+RowNo()-1 AS Num,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Date($(varMinDate)+RowNo()-1,'DD/MM/YYYY') AS TempDate&lt;/P&gt;&lt;P&gt;//AUTOGENERATE($(varMaxDate)-$(varMinDate)+1); &lt;/P&gt;&lt;P&gt;AUTOGENERATE 1 WHILE $(varMinDate)+IterNo()-1&amp;lt;= $(varMaxDate);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//*************** Master Calendar ***************&lt;/P&gt;&lt;P&gt;MasterCalendar:&lt;/P&gt;&lt;P&gt;LOAD Date(TempDate,'DD/MM/YYYY') AS %CommonCalendarLink,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; week(TempDate) AS Week,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; year(TempDate) AS Year,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; QuarterName(TempDate) AS QuarterName,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(left(QuarterName(TempDate),7)='Jan-Mar','Q1',&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(left(QuarterName(TempDate),7)='Apr-Jun','Q2',&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(left(QuarterName(TempDate),7)='Jul-Sep','Q3','Q4'))) as Quarter,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; month(TempDate) AS Month,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; day(TempDate) AS Day,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; weekday(TempDate) AS WeekDay,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date(monthstart(TempDate), 'MMM-YYYY') AS MonthYear,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; week(TempDate)&amp;amp;'-'&amp;amp;Year(TempDate) AS WeekYear,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Year2Date(TempDate, 0, 1, $(vToday))*-1 AS CurYTDFlag,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Year2Date(TempDate,-1, 1, $(vToday))*-1 AS LastYTDFlag&lt;/P&gt;&lt;P&gt;RESIDENT TempCalendar&amp;nbsp; &lt;/P&gt;&lt;P&gt;ORDER BY TempDate Asc; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Drop table TempCalendar;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Oct 2013 06:36:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Month-Year-date-field-in-date-sort-order/m-p/500803#M552817</guid>
      <dc:creator>preminqlik</dc:creator>
      <dc:date>2013-10-02T06:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: Month/Year date field in date sort order</title>
      <link>https://community.qlik.com/t5/QlikView/Month-Year-date-field-in-date-sort-order/m-p/500804#M552818</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;It can be done both script and design.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;USE THE DUAL FUNCTION&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The Dual function can often be used to solve trickier problems. The Dual function lets you&lt;/P&gt;&lt;P&gt;specify both a numeric value as well as which text to associate with this value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; For instance, if you want to use the week number, but sorted correctly also over the change&lt;/P&gt;&lt;P&gt;of the year, then you should use the date number as numeric value but display the week&lt;/P&gt;&lt;P&gt;number, optionally together with the year:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;For example :&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Dual( Week( Date ), WeekStart( Date ) ) as YearWeek&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Dimension:&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;Dual(Date(DateFieldName, MonthEnd(DateFieldName))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sort tab:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Numeric Value : Asc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Note :&lt;/STRONG&gt; DateFieldName is MMM-YY format otherwise use like this &lt;STRONG&gt;Dual(Date(DateFieldName, 'MMM-YY'), MonthEnd(DateFieldName))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope its help,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Oct 2013 06:42:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Month-Year-date-field-in-date-sort-order/m-p/500804#M552818</guid>
      <dc:creator>v_iyyappan</dc:creator>
      <dc:date>2013-10-02T06:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: Month/Year date field in date sort order</title>
      <link>https://community.qlik.com/t5/QlikView/Month-Year-date-field-in-date-sort-order/m-p/500805#M552819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This solution helped me with my problem for sorting the date value in MMM-YYYY text format by using the DUAL function which Iyyappan mentioned above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jul 2017 16:51:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Month-Year-date-field-in-date-sort-order/m-p/500805#M552819</guid>
      <dc:creator />
      <dc:date>2017-07-12T16:51:49Z</dc:date>
    </item>
  </channel>
</rss>

