<?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 Compare dates in Load statement in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Compare-dates-in-Load-statement/m-p/336352#M1176809</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I added an input box to show the value of the vCompareDate variable and it turned out that the formats differed, so I changed the format of the variable like this:&lt;/P&gt;&lt;P&gt;LET vCompareDate = date(AddMonths(Peek('UptimeDate', -1, 'UptimePerDayTemp3'), -1), 'M/D/YYYY');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the If statement still only evaluates to True.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The UptimeDate field in the table contains every date from 1/4/2010 to 4/1/2012.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The vCompareDate variable contains "3/1/2012" (1st of March).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Apr 2012 12:32:17 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-04-04T12:32:17Z</dc:date>
    <item>
      <title>Compare dates in Load statement</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-dates-in-Load-statement/m-p/336350#M1176807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to add a flag field in a Load statement by comparing a date field in the database to a date in a variable. The variable is set like this:&lt;/P&gt;&lt;P&gt;LET vCompareDate = date(AddMonths(Peek('UptimeDate', -1, 'UptimePerDayTemp'), -1), 'DD/MM/YY');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And the Load statement looks like this:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;UptimeDate,&lt;/P&gt;&lt;P&gt;If (UptimeDate &amp;gt; $(vCompareDate), 1, 0) as LastMonthFlag&lt;/P&gt;&lt;P&gt;Resident UptimePerDayTemp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I get only 1, i.e. the If statement always evaluates to True. Why?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2012 09:13:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-dates-in-Load-statement/m-p/336350#M1176807</guid>
      <dc:creator />
      <dc:date>2012-04-04T09:13:48Z</dc:date>
    </item>
    <item>
      <title>Compare dates in Load statement</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-dates-in-Load-statement/m-p/336351#M1176808</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Most of the time this is a format issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What you should do is compair the format of your field: UptimeDate with the format of your variable $(vCompareDate)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In other words does the data in the field "UptimeDate" the same as when you show your&amp;nbsp; variable $(vCompareDate) (fe) in a inputbox.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2012 11:59:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-dates-in-Load-statement/m-p/336351#M1176808</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-04-04T11:59:53Z</dc:date>
    </item>
    <item>
      <title>Compare dates in Load statement</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-dates-in-Load-statement/m-p/336352#M1176809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I added an input box to show the value of the vCompareDate variable and it turned out that the formats differed, so I changed the format of the variable like this:&lt;/P&gt;&lt;P&gt;LET vCompareDate = date(AddMonths(Peek('UptimeDate', -1, 'UptimePerDayTemp3'), -1), 'M/D/YYYY');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the If statement still only evaluates to True.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The UptimeDate field in the table contains every date from 1/4/2010 to 4/1/2012.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The vCompareDate variable contains "3/1/2012" (1st of March).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2012 12:32:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-dates-in-Load-statement/m-p/336352#M1176809</guid>
      <dc:creator />
      <dc:date>2012-04-04T12:32:17Z</dc:date>
    </item>
    <item>
      <title>Compare dates in Load statement</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-dates-in-Load-statement/m-p/336353#M1176810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does your UptimeDate field als has the format 'M/D/YYYY' ? &lt;/P&gt;&lt;P&gt;(just making sure it is not 'D/M/YYYY' or maybe 'MM/DD/YYYY')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If so try to Floor your date : &lt;/P&gt;&lt;P&gt;Date(FLOOR(UptimeDate) , 'M/D/YYYY')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am pretty sure it's a format thing...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2012 12:40:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-dates-in-Load-statement/m-p/336353#M1176810</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-04-04T12:40:46Z</dc:date>
    </item>
    <item>
      <title>Compare dates in Load statement</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-dates-in-Load-statement/m-p/336354#M1176811</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Yes, they both have the format 'M/D/YYYY'. I tried your suggestion without any luck, but then I tried using Num instead (since you thought it was a format thing), and now it works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The new variable assignment:&lt;/P&gt;&lt;P&gt;LET vCompareDate = Num(AddMonths(Peek('UptimeDate', -1, 'UptimePerDayTemp'), -1));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The new Load statement:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt; UptimeDate,&lt;/P&gt;&lt;P&gt; If (Num(UptimeDate) &amp;gt; $(vCompareDate), 1, 0) as LastMonthFlag&lt;/P&gt;&lt;P&gt;Resident UptimePerDayTemp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2012 13:18:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-dates-in-Load-statement/m-p/336354#M1176811</guid>
      <dc:creator />
      <dc:date>2012-04-04T13:18:18Z</dc:date>
    </item>
  </channel>
</rss>

