<?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 Loading Data From Years Prior to Max in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Loading-Data-From-Years-Prior-to-Max/m-p/1337025#M828591</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey, I've just started using Qlik Sense and I'm having troubles loading data using the data loader.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've been scripting everything fine so far but I've been having trouble with one piece of the script in regards to loading data on a given interval. Currently i have the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//LET RefDate = (MAX(NUM(Month(OrderDate),00)&amp;amp;Year(OrderDate))-3);&lt;/P&gt;&lt;P&gt;LOAD CustomerID,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; EmployeeID,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Freight,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrderDate,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NUM(Month(OrderDate),00)&amp;amp;'-'&amp;amp;Year(OrderDate) AS MonthDate,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrderID,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ShipperID&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE YEAR(OrderDate)&amp;gt;=(MAX(YEAR(OrderDate))-3);&lt;/P&gt;&lt;P&gt;SQL SELECT *&lt;/P&gt;&lt;P&gt;FROM Orders;&lt;/P&gt;&lt;P&gt;//WHERE YEAR(OrderDate)&amp;gt;=(MAX(YEAR(OrderDate))-3)&lt;/P&gt;&lt;P&gt;//WHERE OrderDate&amp;gt;=(LatestDate-3);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's throwing an exception on all of those methods tried and i'm kinda lost since i understand how to do it using SQL but whenever i declare a variable it doesn't recognize it in the SQL part and whenever I try to do the Where statement in the SQL part I'm lacking the commands to create the range since I can't declare variables in the SQL commands. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What i'm trying to do is find the max date of the data set, possibly concat the month and date together and then subtract 3 from that number. In doing so, i hope to be a be able to set up an interval to test my OrderDate values in order to work with that range. Any ideas?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
    <dc:creator />
    <dc:date>2020-11-25T16:16:04Z</dc:date>
    <item>
      <title>Loading Data From Years Prior to Max</title>
      <link>https://community.qlik.com/t5/QlikView/Loading-Data-From-Years-Prior-to-Max/m-p/1337025#M828591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey, I've just started using Qlik Sense and I'm having troubles loading data using the data loader.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've been scripting everything fine so far but I've been having trouble with one piece of the script in regards to loading data on a given interval. Currently i have the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//LET RefDate = (MAX(NUM(Month(OrderDate),00)&amp;amp;Year(OrderDate))-3);&lt;/P&gt;&lt;P&gt;LOAD CustomerID,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; EmployeeID,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Freight,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrderDate,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NUM(Month(OrderDate),00)&amp;amp;'-'&amp;amp;Year(OrderDate) AS MonthDate,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrderID,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ShipperID&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE YEAR(OrderDate)&amp;gt;=(MAX(YEAR(OrderDate))-3);&lt;/P&gt;&lt;P&gt;SQL SELECT *&lt;/P&gt;&lt;P&gt;FROM Orders;&lt;/P&gt;&lt;P&gt;//WHERE YEAR(OrderDate)&amp;gt;=(MAX(YEAR(OrderDate))-3)&lt;/P&gt;&lt;P&gt;//WHERE OrderDate&amp;gt;=(LatestDate-3);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's throwing an exception on all of those methods tried and i'm kinda lost since i understand how to do it using SQL but whenever i declare a variable it doesn't recognize it in the SQL part and whenever I try to do the Where statement in the SQL part I'm lacking the commands to create the range since I can't declare variables in the SQL commands. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What i'm trying to do is find the max date of the data set, possibly concat the month and date together and then subtract 3 from that number. In doing so, i hope to be a be able to set up an interval to test my OrderDate values in order to work with that range. Any ideas?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loading-Data-From-Years-Prior-to-Max/m-p/1337025#M828591</guid>
      <dc:creator />
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
  </channel>
</rss>

