<?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: Differences in Dates with SQL and LOAD in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Differences-in-Dates-with-SQL-and-LOAD/m-p/496379#M1126544</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Date fields in QlikView are dual data types, stored as a number but displayed as text.&lt;/P&gt;&lt;P&gt;You can use date#() to convert text to date and then use date() to ensure the value is held as a dare in QlikView.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The QlikView Expression below will convert a date held as a string YYYYMMDD into a date value. You can use other format strings.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Date(date#(CreatedDate, 'YYYYMMDD')) as CreatedDate&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Jan 2014 21:20:25 GMT</pubDate>
    <dc:creator>Colin-Albert</dc:creator>
    <dc:date>2014-01-10T21:20:25Z</dc:date>
    <item>
      <title>Differences in Dates with SQL and LOAD</title>
      <link>https://community.qlik.com/t5/QlikView/Differences-in-Dates-with-SQL-and-LOAD/m-p/496377#M1126542</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have been looking at changing some of SQL Querys in to Qlikview LOADS but have an odd problem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In SQL I have this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONVERT(VARCHAR(7), CreateDate, 120) AS CreatedDateYYYYMM &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the LOAD I have this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Date(CreateDate, 'YYYY-MM') AS CreatedDateYYYYMM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a chart with the CreatedDateYYYYMM field as a Dimension and this works as planned with the SQL statement i.e. it displays the number of calls for each month but when using the LOAD it displays each call separately in each month rather than display the total for the month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The date output for each looks the same i.e. 2013-01, 2013-02 etc the only difference I can see is that in the table previewer the CONVERT one is displayed left formatted and the DATE one is right formatted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas why this is?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jan 2014 19:46:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Differences-in-Dates-with-SQL-and-LOAD/m-p/496377#M1126542</guid>
      <dc:creator />
      <dc:date>2014-01-10T19:46:39Z</dc:date>
    </item>
    <item>
      <title>Re: Differences in Dates with SQL and LOAD</title>
      <link>https://community.qlik.com/t5/QlikView/Differences-in-Dates-with-SQL-and-LOAD/m-p/496378#M1126543</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If it's left formatted, it's considering it as a string.&amp;nbsp; If it's right formatted, it's considering it as a number.&amp;nbsp; So for a date, you want it to be right formatted.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jan 2014 19:50:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Differences-in-Dates-with-SQL-and-LOAD/m-p/496378#M1126543</guid>
      <dc:creator>Nicole-Smith</dc:creator>
      <dc:date>2014-01-10T19:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: Differences in Dates with SQL and LOAD</title>
      <link>https://community.qlik.com/t5/QlikView/Differences-in-Dates-with-SQL-and-LOAD/m-p/496379#M1126544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Date fields in QlikView are dual data types, stored as a number but displayed as text.&lt;/P&gt;&lt;P&gt;You can use date#() to convert text to date and then use date() to ensure the value is held as a dare in QlikView.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The QlikView Expression below will convert a date held as a string YYYYMMDD into a date value. You can use other format strings.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Date(date#(CreatedDate, 'YYYYMMDD')) as CreatedDate&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jan 2014 21:20:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Differences-in-Dates-with-SQL-and-LOAD/m-p/496379#M1126544</guid>
      <dc:creator>Colin-Albert</dc:creator>
      <dc:date>2014-01-10T21:20:25Z</dc:date>
    </item>
    <item>
      <title>Re: Differences in Dates with SQL and LOAD</title>
      <link>https://community.qlik.com/t5/QlikView/Differences-in-Dates-with-SQL-and-LOAD/m-p/496380#M1126545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I thought it was probably something to do with the different internal formatting but if I use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Date(date#(CreatedDate, 'YYYY-MM')) as CreatedDate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The CreatedDate column has no values in it at all&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jan 2014 17:50:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Differences-in-Dates-with-SQL-and-LOAD/m-p/496380#M1126545</guid>
      <dc:creator />
      <dc:date>2014-01-13T17:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: Differences in Dates with SQL and LOAD</title>
      <link>https://community.qlik.com/t5/QlikView/Differences-in-Dates-with-SQL-and-LOAD/m-p/496381#M1126546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Inside the date#() you need the original formatting, and in the date() you need the output formatting.&amp;nbsp; From what I'm gathering, you want the output to be 'YYYY-MM', so you have that in the wrong spot.&amp;nbsp; You need to put the correct initial formatting within the date#():&lt;/P&gt;&lt;P&gt;Date(date#(CreatedDate, 'DD/MM/YYYY'), 'YYYY-MM') as CreatedDate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Replace the 'DD/MM/YYYY' with whatever your original date formatting is.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jan 2014 18:00:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Differences-in-Dates-with-SQL-and-LOAD/m-p/496381#M1126546</guid>
      <dc:creator>Nicole-Smith</dc:creator>
      <dc:date>2014-01-13T18:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: Differences in Dates with SQL and LOAD</title>
      <link>https://community.qlik.com/t5/QlikView/Differences-in-Dates-with-SQL-and-LOAD/m-p/496382#M1126547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The original date field is a date time field...would that be having an impact when its being converted.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jan 2014 18:12:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Differences-in-Dates-with-SQL-and-LOAD/m-p/496382#M1126547</guid>
      <dc:creator />
      <dc:date>2014-01-13T18:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: Differences in Dates with SQL and LOAD</title>
      <link>https://community.qlik.com/t5/QlikView/Differences-in-Dates-with-SQL-and-LOAD/m-p/496383#M1126548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It should make no difference to the format expression your data being a datetime field. Obviously applying a date format without a time component means that the time value will be lost.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In QlikView it is best practice to separate datetime fields into separate date and time fields where you want both components, as this reduces the number of unique data values, so the data can be stored much more efficiently in QlikView.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jan 2014 18:19:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Differences-in-Dates-with-SQL-and-LOAD/m-p/496383#M1126548</guid>
      <dc:creator>Colin-Albert</dc:creator>
      <dc:date>2014-01-13T18:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: Differences in Dates with SQL and LOAD</title>
      <link>https://community.qlik.com/t5/QlikView/Differences-in-Dates-with-SQL-and-LOAD/m-p/496384#M1126549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have been attempting to separate out the date time fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case if I chart the number value from&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;date#(CreatedDate, 'YYYY-MM')) as CreatedDate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It does chart each unique date/time value as a number which makes makes me think that even when it displays 2013-01 it still internally knows this is a date/time value&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jan 2014 19:11:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Differences-in-Dates-with-SQL-and-LOAD/m-p/496384#M1126549</guid>
      <dc:creator />
      <dc:date>2014-01-13T19:11:18Z</dc:date>
    </item>
    <item>
      <title>Re: Differences in Dates with SQL and LOAD</title>
      <link>https://community.qlik.com/t5/QlikView/Differences-in-Dates-with-SQL-and-LOAD/m-p/496385#M1126550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Data fields in QlikView are held as dual data types.&lt;/P&gt;&lt;P&gt;For date and time fields the data is stored as a number and displayed as text.&lt;/P&gt;&lt;P&gt;You can use text(field) and num(field) to extract the text and number values separately from a dual field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can manually create a dual field using dual(text, number) this can be useful when you want to sort text in a non-alphabetic sequence. e.g. Status values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For datetime data the number is floating point, integer for the date, the decimal part is the time component.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date(floor(datetime_value), 'DD/MM/YYYY')&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; will extract the date only&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; time(frac(datetime_value), 'hh:mm:ss')&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; will extract the time component only&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jan 2014 20:08:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Differences-in-Dates-with-SQL-and-LOAD/m-p/496385#M1126550</guid>
      <dc:creator>Colin-Albert</dc:creator>
      <dc:date>2014-01-13T20:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: Differences in Dates with SQL and LOAD</title>
      <link>https://community.qlik.com/t5/QlikView/Differences-in-Dates-with-SQL-and-LOAD/m-p/496386#M1126551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That makes sense but I still end up a graph that shows a column for each day of each month rather than single columns showing the total for each month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried using the floor function in the LOAD script and in the expression but the same thing occurs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also tried using LEFT to strip of the date part before doing a conversion.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jan 2014 20:28:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Differences-in-Dates-with-SQL-and-LOAD/m-p/496386#M1126551</guid>
      <dc:creator />
      <dc:date>2014-01-13T20:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: Differences in Dates with SQL and LOAD</title>
      <link>https://community.qlik.com/t5/QlikView/Differences-in-Dates-with-SQL-and-LOAD/m-p/496387#M1126552</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The reason you are seeing each day is that date(date_field, 'YYYY-MM) will alter the text component but leave the numeric part of the dual field unchanged.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try monthstart(date_field) instead.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jan 2014 20:48:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Differences-in-Dates-with-SQL-and-LOAD/m-p/496387#M1126552</guid>
      <dc:creator>Colin-Albert</dc:creator>
      <dc:date>2014-01-13T20:48:33Z</dc:date>
    </item>
    <item>
      <title>Re: Differences in Dates with SQL and LOAD</title>
      <link>https://community.qlik.com/t5/QlikView/Differences-in-Dates-with-SQL-and-LOAD/m-p/496388#M1126553</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATE(MONTHSTART(CreatedDate), 'YYYY-MM')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and this gave me the output for each month on the chart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only problem now is that the monthly totals dont match up with the previous chart and are for the most part less than the prevvious chart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for all the help and advice...as always I've learned more about QV than I had bargained for.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jan 2014 21:39:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Differences-in-Dates-with-SQL-and-LOAD/m-p/496388#M1126553</guid>
      <dc:creator />
      <dc:date>2014-01-13T21:39:59Z</dc:date>
    </item>
    <item>
      <title>Re: Differences in Dates with SQL and LOAD</title>
      <link>https://community.qlik.com/t5/QlikView/Differences-in-Dates-with-SQL-and-LOAD/m-p/496389#M1126554</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I figured out what I'd done to get the totals wrong...wasn't anything to do with the dates...was just something else that got changed while trying to figure why this wasn't working and its corrected now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jan 2014 21:59:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Differences-in-Dates-with-SQL-and-LOAD/m-p/496389#M1126554</guid>
      <dc:creator />
      <dc:date>2014-01-13T21:59:05Z</dc:date>
    </item>
  </channel>
</rss>

