<?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: Unable to find difference between two dates in chart in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Unable-to-find-difference-between-two-dates-in-chart/m-p/955671#M328445</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;QV implicitly converts literal strings to date/time values when dat/time values are expected, but it does not do so with fields. I expect your fields are loaded as strings. Either convert the values to date/times during the initial load (preferred) or explicitly convert them in the chart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;During LOAD (Best option):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EXIT_DATETIME As s&lt;SPAN style="font-size: 13.3333330154419px;"&gt;EXIT_DATETIME,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Timestamp#(&lt;SPAN style="font-size: 13.3333330154419px;"&gt;EXIT_DATETIME, 'YYYY-MM-DD hh:mm:ss') As &lt;SPAN style="font-size: 13.3333330154419px;"&gt;EXIT_DATETIME,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ENTRY_DATETIME As s&lt;SPAN style="font-size: 13.3333330154419px;"&gt;ENTRY&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;_DATETIME,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Timestamp#(&lt;SPAN style="font-size: 13.3333330154419px;"&gt;ENTRY_DATETIME &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;, 'YYYY-MM-DD hh:mm:ss') As &lt;SPAN style="font-size: 13.3333330154419px;"&gt;ENTRY_DATETIME&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Expression:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =Interval( &lt;SPAN style="font-size: 13.3333330154419px;"&gt;Timestamp#(&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;EXIT_DATETIME, 'YYYY-MM-DD hh:mm:ss') - &lt;SPAN style="font-size: 13.3333330154419px;"&gt;Timestamp#(&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;ENTRY_DATETIME &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;, 'YYYY-MM-DD hh:mm:ss'), 'D hh:mm')&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 Sep 2015 09:40:13 GMT</pubDate>
    <dc:creator>jonathandienst</dc:creator>
    <dc:date>2015-09-02T09:40:13Z</dc:date>
    <item>
      <title>Unable to find difference between two dates in chart</title>
      <link>https://community.qlik.com/t5/QlikView/Unable-to-find-difference-between-two-dates-in-chart/m-p/955670#M328444</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 have two datetime fields in a chart, one is EXIT_DATETIME and the other is ENTRY_DATETIME. Both are formatted as YYYY-MM-DD hh:mm:ss, eg. 2015-08-25 17:03:00. I want to subtract one from the other but I am having trouble with the Interval function. If I create an expression (or calculated dimension, it doesn't matter which) in the chart that reads: &lt;STRONG&gt;=Interval(EXIT_DATETIME - ENTRY_DATETIME,'D hh:mm')&lt;/STRONG&gt; , QV returns a '-' in that column indicating that it cannot calculate. However, if I create an expression that reads: &lt;STRONG&gt;=Interval('2015-08-25 08:09:55' - '2015-08-25 07:58:55','D hh:mm') &lt;/STRONG&gt;, I get the correct answer of &lt;STRONG&gt;0 00:11&lt;/STRONG&gt; in that field. Why does it work when I pass the function specific dates as strings, but fails when I pass it the column names of the date columns want to calculate the actual differences for?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Sep 2015 09:36:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Unable-to-find-difference-between-two-dates-in-chart/m-p/955670#M328444</guid>
      <dc:creator />
      <dc:date>2015-09-02T09:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to find difference between two dates in chart</title>
      <link>https://community.qlik.com/t5/QlikView/Unable-to-find-difference-between-two-dates-in-chart/m-p/955671#M328445</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;QV implicitly converts literal strings to date/time values when dat/time values are expected, but it does not do so with fields. I expect your fields are loaded as strings. Either convert the values to date/times during the initial load (preferred) or explicitly convert them in the chart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;During LOAD (Best option):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EXIT_DATETIME As s&lt;SPAN style="font-size: 13.3333330154419px;"&gt;EXIT_DATETIME,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Timestamp#(&lt;SPAN style="font-size: 13.3333330154419px;"&gt;EXIT_DATETIME, 'YYYY-MM-DD hh:mm:ss') As &lt;SPAN style="font-size: 13.3333330154419px;"&gt;EXIT_DATETIME,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ENTRY_DATETIME As s&lt;SPAN style="font-size: 13.3333330154419px;"&gt;ENTRY&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;_DATETIME,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333330154419px;"&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Timestamp#(&lt;SPAN style="font-size: 13.3333330154419px;"&gt;ENTRY_DATETIME &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;, 'YYYY-MM-DD hh:mm:ss') As &lt;SPAN style="font-size: 13.3333330154419px;"&gt;ENTRY_DATETIME&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Expression:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =Interval( &lt;SPAN style="font-size: 13.3333330154419px;"&gt;Timestamp#(&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;EXIT_DATETIME, 'YYYY-MM-DD hh:mm:ss') - &lt;SPAN style="font-size: 13.3333330154419px;"&gt;Timestamp#(&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;ENTRY_DATETIME &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;, 'YYYY-MM-DD hh:mm:ss'), 'D hh:mm')&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Sep 2015 09:40:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Unable-to-find-difference-between-two-dates-in-chart/m-p/955671#M328445</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2015-09-02T09:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to find difference between two dates in chart</title>
      <link>https://community.qlik.com/t5/QlikView/Unable-to-find-difference-between-two-dates-in-chart/m-p/955672#M328446</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the assistance, I already have in my load script the following line to convert ENTRY_DATETIME to an actual date, if that's one of the options you mean:&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;Date#(MID(DATE,2,10) &amp;amp; ENTRY,'YYYY-MM-DD hh:mm:ss') AS ENTRY_DATETIME,&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;ETC....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using MID to leave out some characters at the end of the DATE field before concatenating it to an ENTRY field which has the time component. All my dates come out as YYYY-MM-DD hh:mm:ss with no leading or trailing spaces. This is also what my standard date format is set to in my load script. However this doesn't make a difference&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I instead convert to Date explicitly in my chart, it doesn't work either:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=Interval(Date#(EXIT_DATETIME,'YYYY-MM-DD hh:mm:ss') - Date#(ENTRY_DATETIME,'YYYY-MM-DD hh:mm:ss'),'D hh:mm')&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;​Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Sep 2015 09:49:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Unable-to-find-difference-between-two-dates-in-chart/m-p/955672#M328446</guid>
      <dc:creator />
      <dc:date>2015-09-02T09:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to find difference between two dates in chart</title>
      <link>https://community.qlik.com/t5/QlikView/Unable-to-find-difference-between-two-dates-in-chart/m-p/955673#M328447</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;maybe&lt;/P&gt;&lt;P&gt;- your datetime aren't datetime (check they are right aligned)&lt;/P&gt;&lt;P&gt;- in your chart you have more entry and/or exit datetime for dimension (try to add a rowno() to the load and use it in the chart)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Sep 2015 20:37:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Unable-to-find-difference-between-two-dates-in-chart/m-p/955673#M328447</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2015-09-02T20:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to find difference between two dates in chart</title>
      <link>https://community.qlik.com/t5/QlikView/Unable-to-find-difference-between-two-dates-in-chart/m-p/955674#M328448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, I found the problem, it wasn't either of these but I appreciate your help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Sep 2015 06:22:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Unable-to-find-difference-between-two-dates-in-chart/m-p/955674#M328448</guid>
      <dc:creator />
      <dc:date>2015-09-03T06:22:38Z</dc:date>
    </item>
  </channel>
</rss>

