<?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 Order Stacked chart by date field. in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Order-Stacked-chart-by-date-field/m-p/144722#M505661</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's easy to see the format of your "MyDate" field in the Document properties - number.&lt;BR /&gt;And you can convert it in the the script using many ways, including that from John.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 May 2009 02:29:29 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2009-05-27T02:29:29Z</dc:date>
    <item>
      <title>Order Stacked chart by date field.</title>
      <link>https://community.qlik.com/t5/QlikView/Order-Stacked-chart-by-date-field/m-p/144718#M505657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I've tried to Sort Stacked chart by date field. Using "numeric Ascending"&lt;/P&gt;&lt;P&gt;Date field is displayed as "May 2009".."Apr 2009"... etc..&lt;/P&gt;&lt;P&gt;However it does not change it's order.&lt;/P&gt;&lt;P&gt;I would like to keep the display as "MMM YYYY" but still have it sorted.&lt;/P&gt;&lt;P&gt;Any help?&lt;/P&gt;&lt;P&gt;Tried:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;date(a, 'MMM YYYY')&lt;/P&gt;&lt;P&gt;and also:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=&lt;/P&gt;&lt;P&gt;month(a) &amp;amp; ' ' &amp;amp; Year(a)&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2009 22:20:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Order-Stacked-chart-by-date-field/m-p/144718#M505657</guid>
      <dc:creator />
      <dc:date>2009-05-21T22:20:08Z</dc:date>
    </item>
    <item>
      <title>Order Stacked chart by date field.</title>
      <link>https://community.qlik.com/t5/QlikView/Order-Stacked-chart-by-date-field/m-p/144719#M505658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This shouldn't be a problem. Make sure that your field "a" is numeric (date is also numeric). Can you post an example of the problem?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2009 22:44:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Order-Stacked-chart-by-date-field/m-p/144719#M505658</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-05-21T22:44:29Z</dc:date>
    </item>
    <item>
      <title>Order Stacked chart by date field.</title>
      <link>https://community.qlik.com/t5/QlikView/Order-Stacked-chart-by-date-field/m-p/144720#M505659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok so lets look at the SQL Statement I made:&lt;/P&gt;&lt;P&gt;SQL SELECT convert(date, Date, 103) as MyDate,&lt;BR /&gt; ID as MyID,&lt;BR /&gt; Value as MyValue&lt;BR /&gt;FROM MyDatabase&lt;BR /&gt;WHERE Date&amp;gt;= '20080101';&lt;/P&gt;&lt;P&gt;First of all I'm not convinced that the WHERE clause is correct, since I havn't told it should compare Date to a date in the format YYYYMMDD.&lt;/P&gt;&lt;P&gt;So if you could advise me there I would appreciate it.&lt;/P&gt;&lt;P&gt;Otherwise that's how I pull the data in, and the type IS (or rather should be) a date, which is as you say numeric, yet it still doesn't order them correctly.&lt;/P&gt;&lt;P&gt;Any help?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2009 16:49:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Order-Stacked-chart-by-date-field/m-p/144720#M505659</guid>
      <dc:creator />
      <dc:date>2009-05-26T16:49:14Z</dc:date>
    </item>
    <item>
      <title>Order Stacked chart by date field.</title>
      <link>https://community.qlik.com/t5/QlikView/Order-Stacked-chart-by-date-field/m-p/144721#M505660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin:0in 0in 0pt;"&gt;Well, I don't know what format you're using in your database for Date. In our shop, it's usually a numeric field in the form YYYYMMDD. For the sake of argument, I'll assume your shop is the same. Then I'd do it more like this:&lt;/P&gt;&lt;P style="margin:0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0in 0in 0pt;"&gt;LOAD&lt;/P&gt;&lt;P style="margin:0in 0in 0pt;"&gt;date(date#(Date,'YYYYMMDD'),'MM/DD/YY') as MyDate&lt;/P&gt;&lt;P style="margin:0in 0in 0pt;"&gt;,ID as MyID&lt;/P&gt;&lt;P style="margin:0in 0in 0pt;"&gt;,Value as MyValue&lt;/P&gt;&lt;P style="margin:0in 0in 0pt;"&gt;;&lt;/P&gt;&lt;P style="margin:0in 0in 0pt;"&gt;SQL SELECT&lt;/P&gt;&lt;P style="margin:0in 0in 0pt;"&gt;Date&lt;/P&gt;&lt;P style="margin:0in 0in 0pt;"&gt;,ID&lt;/P&gt;&lt;P style="margin:0in 0in 0pt;"&gt;,Value&lt;/P&gt;&lt;P style="margin:0in 0in 0pt;"&gt;FROM MyDatabase&lt;/P&gt;&lt;P style="margin:0in 0in 0pt;"&gt;WHERE Date &amp;gt;= 20080101&lt;/P&gt;&lt;P style="margin:0in 0in 0pt;"&gt;;&lt;/P&gt;&lt;P style="margin:0in 0in 0pt;"&gt;&lt;/P&gt;&lt;P style="margin:0in 0in 0pt;"&gt;The main idea, though, is that you want MyDate to be a QlikView date, which has a numeric internal representation, which means you can sort by it. I could be way off base on where your problem lies, though.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 May 2009 01:49:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Order-Stacked-chart-by-date-field/m-p/144721#M505660</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2009-05-27T01:49:14Z</dc:date>
    </item>
    <item>
      <title>Order Stacked chart by date field.</title>
      <link>https://community.qlik.com/t5/QlikView/Order-Stacked-chart-by-date-field/m-p/144722#M505661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's easy to see the format of your "MyDate" field in the Document properties - number.&lt;BR /&gt;And you can convert it in the the script using many ways, including that from John.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 May 2009 02:29:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Order-Stacked-chart-by-date-field/m-p/144722#M505661</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-05-27T02:29:29Z</dc:date>
    </item>
    <item>
      <title>Order Stacked chart by date field.</title>
      <link>https://community.qlik.com/t5/QlikView/Order-Stacked-chart-by-date-field/m-p/144723#M505662</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well the format I'm using in my database shouldn't matter since I'm using convert() to pull the date into the format I expect - 103 which is dd/mm/yy&lt;/P&gt;&lt;P&gt;But it is stored as a Date.&lt;/P&gt;&lt;P&gt;I presume when you say numeric, you mean an integer.. the old way of storing..&lt;/P&gt;&lt;P&gt;See I can get an ordering, but only if I set my X axis to display YYYY MM, because YYYYMM format will by design always be in order as an integer.&lt;/P&gt;&lt;P&gt;But this is a pathetic approach, and I would expect qlikview to distinguish between and keep separate the model or internal representation of a date to the view or display of the date.&lt;/P&gt;&lt;P&gt;I should be able to request the Days of the month to be displayed in terms of different breed of monkeys. So long as I define an ordering, qlikview should look at the internal representation of a date, order by that, and then convert it into a monkey...&lt;/P&gt;&lt;P&gt;Are you seriously telling me qlikview orders by what is displayed on the X axis and not by what is held internally?&lt;/P&gt;&lt;P&gt;=Date(HistoryScoreDateB, 'YYYY') &amp;amp; ' '&amp;amp;Date(HistoryScoreDateB, 'MM')&lt;/P&gt;&lt;P&gt;Is the only expression that works and it's all smoke and mirrors since&lt;/P&gt;&lt;P&gt;=Date(HistoryScoreDateB, 'MM') &amp;amp; ' '&amp;amp;Date(HistoryScoreDateB, 'YYYY')&lt;/P&gt;&lt;P&gt;gives me a numeric ordering, but not a date ordering.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 May 2009 15:57:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Order-Stacked-chart-by-date-field/m-p/144723#M505662</guid>
      <dc:creator />
      <dc:date>2009-05-27T15:57:41Z</dc:date>
    </item>
    <item>
      <title>Order Stacked chart by date field.</title>
      <link>https://community.qlik.com/t5/QlikView/Order-Stacked-chart-by-date-field/m-p/144724#M505663</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You don't understand. First, the date is numeric but not integer. Second, even presentation like 'May-09' can be numeric in QV world... And, I recommended to check the format not in the database, but after you loaded it in QV.&lt;BR /&gt;See attched calendar example, and notice that fields Date, Month, Weekday, MonthYear - all sorted by numeric order, and can be sorted this way in a chart as well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 May 2009 20:04:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Order-Stacked-chart-by-date-field/m-p/144724#M505663</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-05-27T20:04:24Z</dc:date>
    </item>
    <item>
      <title>Order Stacked chart by date field.</title>
      <link>https://community.qlik.com/t5/QlikView/Order-Stacked-chart-by-date-field/m-p/144725#M505664</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="jive_text_macro jive_macro_quote" jivemacro="quote"&gt;&lt;BR /&gt;Alkaline wrote:&lt;BR /&gt;=&lt;BR /&gt;&lt;/PRE&gt;date(a, 'MMM YYYY') &lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm guessing from your first post that you are defining the dimension as a Calculated Dimension? If so, the date() expression will generate a set of strings which is not what you want. You want dual values. Two options.&lt;/P&gt;&lt;P&gt;1. Change the document format of the field to be MMM YYYY.&lt;/P&gt;&lt;P&gt;2. Create a new field in the script like:&lt;/P&gt;&lt;P&gt;date(thedate, 'MMM YYYY') as YearMonth&lt;/P&gt;&lt;P&gt;and then use the YearMonth as your dimension.&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2009 11:35:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Order-Stacked-chart-by-date-field/m-p/144725#M505664</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2009-05-28T11:35:07Z</dc:date>
    </item>
    <item>
      <title>Order Stacked chart by date field.</title>
      <link>https://community.qlik.com/t5/QlikView/Order-Stacked-chart-by-date-field/m-p/144726#M505665</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rob,&lt;BR /&gt;The script you suggest will create 'May 2009' &lt;STRONG&gt;31 times&lt;/STRONG&gt;, because it's just a date in the 'MMM YYYY' format. To get it only once, I always use dual(), like this:&lt;BR /&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;dual(month(thedate) &amp;amp; ' ' &amp;amp; year(thedate), year(thedate) &amp;amp; num(month(thedate), '00')) as MonthYear&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;Dual is used by QV as a number but is presented as a string. Or as a number as well, if you wish so. No problem with sorting anyway. &lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2009 20:32:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Order-Stacked-chart-by-date-field/m-p/144726#M505665</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-05-28T20:32:54Z</dc:date>
    </item>
    <item>
      <title>Order Stacked chart by date field.</title>
      <link>https://community.qlik.com/t5/QlikView/Order-Stacked-chart-by-date-field/m-p/144727#M505666</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Michael,&lt;/P&gt;&lt;P&gt;Good point. In practice what I usually do is use the MonthStart date:&lt;/P&gt;&lt;P&gt;date(MonthStart(thedate), 'MMM YYYY') as MonthYear&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2009 00:44:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Order-Stacked-chart-by-date-field/m-p/144727#M505666</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2009-05-29T00:44:08Z</dc:date>
    </item>
    <item>
      <title>Order Stacked chart by date field.</title>
      <link>https://community.qlik.com/t5/QlikView/Order-Stacked-chart-by-date-field/m-p/144728#M505667</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I just posted a Wiki "How to create a Calendar" - &lt;A href="http://community.qlik.com/wikis/qlikview-wiki/how-to-create-a-calendar.aspx"&gt;http://community.qlik.com/wikis/qlikview-wiki/how-to-create-a-calendar.aspx&lt;/A&gt;&lt;BR /&gt;Maybe it will reduce the amount of questions on that topic (wishful thinking...)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2009 03:31:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Order-Stacked-chart-by-date-field/m-p/144728#M505667</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-05-29T03:31:47Z</dc:date>
    </item>
    <item>
      <title>Order Stacked chart by date field.</title>
      <link>https://community.qlik.com/t5/QlikView/Order-Stacked-chart-by-date-field/m-p/144729#M505668</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK,&lt;/P&gt;&lt;P&gt;So the way I got round it, was to load the data in order using ORDER BY in the sql statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2009 22:56:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Order-Stacked-chart-by-date-field/m-p/144729#M505668</guid>
      <dc:creator />
      <dc:date>2009-05-29T22:56:15Z</dc:date>
    </item>
    <item>
      <title>Order Stacked chart by date field.</title>
      <link>https://community.qlik.com/t5/QlikView/Order-Stacked-chart-by-date-field/m-p/144730#M505669</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That works, but isn't "The QlikView Way". It seems to me that either we don't understand your problem, or you don't understand our solutions.&lt;/P&gt;&lt;P&gt;QlikView dates are stored internally as the number of days since 12/30/1899. But QlikView gives you lots of options for how you display the dates, including "May 2009". If you use QlikView dates rather than some other date format, you can then use all of QlikView's date manipulation functions, everything shows up ordered correctly, and life is generally easier. You should use QlikView dates.&lt;/P&gt;&lt;P&gt;Here's an example of turning numeric dates into QlikView dates and months. The first format string tells it the format of the input number, the second tells it the format you want to see in QlikView by default (can be overridden on charts). And attached is an application using this exact script, then doing a stacked bar chart by month with the months in order. So far as I understand, that's what you want. It does not require sorting the input data. It only requires using the right format for your dates.&lt;/P&gt;&lt;P&gt;LOAD&lt;BR /&gt; date(date#(Date,'YYYYMMDD'),'DD/MM/YY') as Date&lt;BR /&gt;,date(monthstart(date#(Date,'YYYYMMDD')),'MMMM YYYY') as Month&lt;BR /&gt;,pow(10,rand()*3) as Sales&lt;BR /&gt;,pick(ceil(rand()*2),'Company A','Company B') as Customer&lt;BR /&gt;INLINE [&lt;BR /&gt;Date&lt;BR /&gt;20081201&lt;BR /&gt;20090522&lt;BR /&gt;20090505&lt;BR /&gt;20090413&lt;BR /&gt;20090108&lt;BR /&gt;20090220&lt;BR /&gt;20081215&lt;BR /&gt;20090221&lt;BR /&gt;20090317&lt;BR /&gt;20090316&lt;BR /&gt;];&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 May 2009 00:30:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Order-Stacked-chart-by-date-field/m-p/144730#M505669</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2009-05-30T00:30:13Z</dc:date>
    </item>
  </channel>
</rss>

