<?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 in the where clause not working in the qlikview script. in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/variable-in-the-where-clause-not-working-in-the-qlikview-script/m-p/1902745#M1217784</link>
    <description>&lt;P&gt;Hi there,&lt;/P&gt;
&lt;P&gt;Please help me out with the below script -&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;let vDayPrev = 31;&lt;/P&gt;
&lt;P&gt;TMP:&lt;BR /&gt;LOAD&lt;BR /&gt;MAX([Date]) as MaxDate&lt;BR /&gt;FROM [$(vL.QVDPath)\QVD \File.qvd]&lt;BR /&gt;(qvd);&lt;BR /&gt;let vMD_ToC = Num(Peek('MaxDate', 0, 'TMP'));&lt;/P&gt;
&lt;P&gt;[ToC]:&lt;BR /&gt;LOAD&lt;BR /&gt;MakeDate(Year([ Date]),Month([Date]),Day([ Date])) as [ReportingDate],&lt;BR /&gt;[Identifier],&lt;BR /&gt;count(1) as count_toc&lt;BR /&gt;from&lt;BR /&gt;[$(vL.QVDPath)\QVD \File.qvd]&lt;BR /&gt;(qvd)&lt;BR /&gt;WHERE&lt;BR /&gt;[Date] &amp;gt;= '$(vMD_ToC)'-$(vDayPrev) AND [ Date] &amp;lt;= '$(vMD_ToC)'&lt;BR /&gt;group by [ Identifier],[Date];&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is wrong with the script . Please suggest .&lt;/P&gt;
&lt;P&gt;My req , I want Maxdate - 31 days in the where condition i.e&amp;nbsp;&lt;/P&gt;
&lt;P&gt;WHERE&lt;BR /&gt;[Date] &amp;gt;= '$(vMD_ToC)'-$(vDayPrev) AND [ Date] &amp;lt;= '$(vMD_ToC)'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Wed, 09 Mar 2022 06:13:31 GMT</pubDate>
    <dc:creator>ashmitp869</dc:creator>
    <dc:date>2022-03-09T06:13:31Z</dc:date>
    <item>
      <title>variable in the where clause not working in the qlikview script.</title>
      <link>https://community.qlik.com/t5/QlikView/variable-in-the-where-clause-not-working-in-the-qlikview-script/m-p/1902745#M1217784</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;
&lt;P&gt;Please help me out with the below script -&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;let vDayPrev = 31;&lt;/P&gt;
&lt;P&gt;TMP:&lt;BR /&gt;LOAD&lt;BR /&gt;MAX([Date]) as MaxDate&lt;BR /&gt;FROM [$(vL.QVDPath)\QVD \File.qvd]&lt;BR /&gt;(qvd);&lt;BR /&gt;let vMD_ToC = Num(Peek('MaxDate', 0, 'TMP'));&lt;/P&gt;
&lt;P&gt;[ToC]:&lt;BR /&gt;LOAD&lt;BR /&gt;MakeDate(Year([ Date]),Month([Date]),Day([ Date])) as [ReportingDate],&lt;BR /&gt;[Identifier],&lt;BR /&gt;count(1) as count_toc&lt;BR /&gt;from&lt;BR /&gt;[$(vL.QVDPath)\QVD \File.qvd]&lt;BR /&gt;(qvd)&lt;BR /&gt;WHERE&lt;BR /&gt;[Date] &amp;gt;= '$(vMD_ToC)'-$(vDayPrev) AND [ Date] &amp;lt;= '$(vMD_ToC)'&lt;BR /&gt;group by [ Identifier],[Date];&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is wrong with the script . Please suggest .&lt;/P&gt;
&lt;P&gt;My req , I want Maxdate - 31 days in the where condition i.e&amp;nbsp;&lt;/P&gt;
&lt;P&gt;WHERE&lt;BR /&gt;[Date] &amp;gt;= '$(vMD_ToC)'-$(vDayPrev) AND [ Date] &amp;lt;= '$(vMD_ToC)'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2022 06:13:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/variable-in-the-where-clause-not-working-in-the-qlikview-script/m-p/1902745#M1217784</guid>
      <dc:creator>ashmitp869</dc:creator>
      <dc:date>2022-03-09T06:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: variable in the where clause not working in the qlikview script.</title>
      <link>https://community.qlik.com/t5/QlikView/variable-in-the-where-clause-not-working-in-the-qlikview-script/m-p/1902819#M1217789</link>
      <description>&lt;P&gt;Since I cannot see your data, I cannot tell for sure... but I would try a Where-clause like this instead:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;WHERE&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[Date] &amp;gt;= $(#vMD_ToC)-$(#vDayPrev) AND [Date] &amp;lt;= $(#vMD_ToC)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Also, you have an error in several places in the script:&amp;nbsp;[Date] is not the same as [ Date]. You cannot have an extra space inside the quotes. What's inside the quotes must be exactly the same as the field name.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2022 08:53:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/variable-in-the-where-clause-not-working-in-the-qlikview-script/m-p/1902819#M1217789</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2022-03-09T08:53:47Z</dc:date>
    </item>
  </channel>
</rss>

