<?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 Why LET vTodaysDate = Num(Today()) when comparing? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Why-LET-vTodaysDate-Num-Today-when-comparing/m-p/447180#M166835</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;When doing a LOAD on a table using a WHERE on a date, like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD Date, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Column2,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Column3&lt;/P&gt;&lt;P&gt;FROM MySpreadsheet.xlsx&lt;/P&gt;&lt;P&gt;(ooxml, embedded labels, table is Sheet1);&lt;/P&gt;&lt;P&gt;WHERE MyDate = $(vTodaysDate) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why do I have to set (LET) the variable using the NUM function?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vTodaysDate = Num(Today())&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why can't it just be vTodaysDay = Today()? Which I see doesnt work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 19 Nov 2012 15:39:00 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-11-19T15:39:00Z</dc:date>
    <item>
      <title>Why LET vTodaysDate = Num(Today()) when comparing?</title>
      <link>https://community.qlik.com/t5/QlikView/Why-LET-vTodaysDate-Num-Today-when-comparing/m-p/447180#M166835</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;When doing a LOAD on a table using a WHERE on a date, like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD Date, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Column2,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Column3&lt;/P&gt;&lt;P&gt;FROM MySpreadsheet.xlsx&lt;/P&gt;&lt;P&gt;(ooxml, embedded labels, table is Sheet1);&lt;/P&gt;&lt;P&gt;WHERE MyDate = $(vTodaysDate) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why do I have to set (LET) the variable using the NUM function?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vTodaysDate = Num(Today())&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why can't it just be vTodaysDay = Today()? Which I see doesnt work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Nov 2012 15:39:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-LET-vTodaysDate-Num-Today-when-comparing/m-p/447180#M166835</guid>
      <dc:creator />
      <dc:date>2012-11-19T15:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: Why LET vTodaysDate = Num(Today()) when comparing?</title>
      <link>https://community.qlik.com/t5/QlikView/Why-LET-vTodaysDate-Num-Today-when-comparing/m-p/447181#M166836</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you tried enclosing your variable in single quotes to handle the date string correctly?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vTodaysDate = Today();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD Date, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Column2,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Column3&lt;/P&gt;&lt;P&gt;FROM MySpreadsheet.xlsx&lt;/P&gt;&lt;P&gt;(ooxml, embedded labels, table is Sheet1)&lt;/P&gt;&lt;P&gt;WHERE MyDate = '$(vTodaysDate)'; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(is MyDate another field in this Excel file or do you want to use in fact the Date field?)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Nov 2012 16:05:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-LET-vTodaysDate-Num-Today-when-comparing/m-p/447181#M166836</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-11-19T16:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: Why LET vTodaysDate = Num(Today()) when comparing?</title>
      <link>https://community.qlik.com/t5/QlikView/Why-LET-vTodaysDate-Num-Today-when-comparing/m-p/447182#M166837</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The Today() function is a dual function This means that it returns both a string and a number. Hence&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Let vTodaysDate = Text(Today());&lt;/P&gt;&lt;P&gt;will assign a string, whereas&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Let vTodaysDate = Num(Today());&lt;/P&gt;&lt;P&gt;will assign a number to the variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A comparison with a date (the where clause) requires that the other side of the equal sign can be interpreted as a number, e.g. a valid date format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stefan's solution works fine, since the single quotes force QlikView to treat the variable as a string and QlikView then tries to interpret the string and also succeeds, since the string contains a valid date format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(see more on &lt;A _jive_internal="true" class="loading" href="https://community.qlik.com/blogs/qlikviewdesignblog/2012/11/13/dual" title="http://community.qlik.com/blogs/qlikviewdesignblog/2012/11/13/dual"&gt;http://community.qlik.com/blogs/qlikviewdesignblog/2012/11/13/dual&lt;/A&gt;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Nov 2012 16:52:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-LET-vTodaysDate-Num-Today-when-comparing/m-p/447182#M166837</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2012-11-19T16:52:31Z</dc:date>
    </item>
  </channel>
</rss>

