<?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: Dates in Where Clause in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Dates-in-Where-Clause/m-p/403863#M150263</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gysbert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for answering the question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the solution would work correctly with a small dataset. I have tried that on 11 million records and for obvious reasons getting a max takes a huge time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure if there any way I can apply the date filter in the where clause on the original data set rather than getting a max and applying the filter on resident load?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 05 Mar 2013 09:54:02 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-03-05T09:54:02Z</dc:date>
    <item>
      <title>Dates in Where Clause</title>
      <link>https://community.qlik.com/t5/QlikView/Dates-in-Where-Clause/m-p/403860#M150260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have simple script with 4 records. I'm trying to use dates in the where clause to filter data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the attached script if I hard code the date in the where clause it works but does not seem to work with a variable although the variable is returning back the same value as the hard-coded one.&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>Mon, 04 Mar 2013 12:46:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dates-in-Where-Clause/m-p/403860#M150260</guid>
      <dc:creator />
      <dc:date>2013-03-04T12:46:30Z</dc:date>
    </item>
    <item>
      <title>Re: Dates in Where Clause</title>
      <link>https://community.qlik.com/t5/QlikView/Dates-in-Where-Clause/m-p/403861#M150261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;This won't work: &lt;EM&gt;Let vDate= '=DATE(Max(Date)-1)';&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;That sets vDate to a string. Furthermore that string can't be evaluated since it's not a correct expression. And there is no Date to get the max from yet since you haven't loaded anything. Your statement is at the top of the script when the internal database is still empty.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;What you can do is create the variable at the end of the script&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;HowToTab:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Load * inline [&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;&lt;EM&gt;...etc...&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Temp:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;load max(Date) as MaxDate;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;load FieldValue('Date',IterNo()) as Date&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;autogenerate(FieldValueCount('Date'));&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;LET vDate = peek('MaxDate');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;drop table Temp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;The next time you reload vDate will have the value of the maximum Date of the previous reload.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;If you want to set the variable in the UI by selecting a value in the listbox then you need to add a Set Variable action to the OnSelect trigger of the Date field.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Mar 2013 13:01:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dates-in-Where-Clause/m-p/403861#M150261</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-03-04T13:01:36Z</dc:date>
    </item>
    <item>
      <title>Re: Dates in Where Clause</title>
      <link>https://community.qlik.com/t5/QlikView/Dates-in-Where-Clause/m-p/403862#M150262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;min and max are aggregation functions, so you need to use along with load Statements&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;load max(Date) as Max_date resident tab;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;using peek() you can retrieve field values&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let vDate=peek('Max_date'); &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Generally min,max the result becomes integer, you need to convert into date using date() function&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Mar 2013 13:03:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dates-in-Where-Clause/m-p/403862#M150262</guid>
      <dc:creator>sivarajs</dc:creator>
      <dc:date>2013-03-04T13:03:35Z</dc:date>
    </item>
    <item>
      <title>Re: Dates in Where Clause</title>
      <link>https://community.qlik.com/t5/QlikView/Dates-in-Where-Clause/m-p/403863#M150263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gysbert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for answering the question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the solution would work correctly with a small dataset. I have tried that on 11 million records and for obvious reasons getting a max takes a huge time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure if there any way I can apply the date filter in the where clause on the original data set rather than getting a max and applying the filter on resident load?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Mar 2013 09:54:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Dates-in-Where-Clause/m-p/403863#M150263</guid>
      <dc:creator />
      <dc:date>2013-03-05T09:54:02Z</dc:date>
    </item>
  </channel>
</rss>

