<?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 Variable Issue in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Variable-Issue/m-p/350936#M493469</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to load data belonging to the latest batch of data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created a max date for data i receive form a database.&lt;/P&gt;&lt;P&gt;MaxDate:&lt;/P&gt;&lt;P&gt;Load Max(Date(Date#(MONTH_BATCH,'YYYY-MM'),'YYYY-MM')) as MaxDate &lt;/P&gt;&lt;P&gt;resident Test ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let vMaxDate = Date(Date#(peek('MaxDate', -1),'YYYY-MM'),'YYYY-MM')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I load the data form the qvd with all the data, I plan to use the vMaxDate variable in the where clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The variable returns the right value ie., '2012-05' when i check it in a text box with the expression '=vMaxDate'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But when I use =$(vMaxDate), the value it returns is 2007.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What could be the issue here?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 14 May 2012 20:56:46 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-05-14T20:56:46Z</dc:date>
    <item>
      <title>Variable Issue</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-Issue/m-p/350936#M493469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to load data belonging to the latest batch of data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created a max date for data i receive form a database.&lt;/P&gt;&lt;P&gt;MaxDate:&lt;/P&gt;&lt;P&gt;Load Max(Date(Date#(MONTH_BATCH,'YYYY-MM'),'YYYY-MM')) as MaxDate &lt;/P&gt;&lt;P&gt;resident Test ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let vMaxDate = Date(Date#(peek('MaxDate', -1),'YYYY-MM'),'YYYY-MM')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I load the data form the qvd with all the data, I plan to use the vMaxDate variable in the where clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The variable returns the right value ie., '2012-05' when i check it in a text box with the expression '=vMaxDate'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But when I use =$(vMaxDate), the value it returns is 2007.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What could be the issue here?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 May 2012 20:56:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-Issue/m-p/350936#M493469</guid>
      <dc:creator />
      <dc:date>2012-05-14T20:56:46Z</dc:date>
    </item>
    <item>
      <title>Variable Issue</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-Issue/m-p/350937#M493470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bharath,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your date is being evaluated as string so when you expand the variable vMaxDate QV is interpreting it as 2012 - 5 which equals 2007.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To have it evaluate to a date remove the date function like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MaxDate:&lt;/P&gt;&lt;P&gt;Load Max(Date#(MONTH_BATCH,'YYYY-MM'),'YYYY-MM') as MaxDate&lt;/P&gt;&lt;P&gt;resident Test ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And to set it to the variable:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let vMaxDate = peek('MaxDate', 0);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The variable will then be 41030 which is May 1, 2012.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 May 2012 22:09:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-Issue/m-p/350937#M493470</guid>
      <dc:creator>tomhoch1</dc:creator>
      <dc:date>2012-05-14T22:09:46Z</dc:date>
    </item>
  </channel>
</rss>

