<?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: Create Open Stock Next Week from Close Stock This Week (Peek or Previous?) in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Create-Open-Stock-Next-Week-from-Close-Stock-This-Week-Peek-or/m-p/834386#M993737</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Massimo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That worked!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One clarification - I wanted to retain the "Close Stk" data. To achieve this, I just reloaded the original data at the end of the script. You might be able to suggest a better way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to understand the reason for the creation of the "cross" table. I suspect it is something to do with arranging the data to allow for the operation of the Previous statement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think I am confused as to the nature of a Resident Load - is it the case that the data loads in reverse?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you get time to respond, that would be great.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If not, thank you for your help so far.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will mark your answer as correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Joe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 27 Jun 2015 13:18:00 GMT</pubDate>
    <dc:creator>mazacini</dc:creator>
    <dc:date>2015-06-27T13:18:00Z</dc:date>
    <item>
      <title>Create Open Stock Next Week from Close Stock This Week (Peek or Previous?)</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Open-Stock-Next-Week-from-Close-Stock-This-Week-Peek-or/m-p/834382#M993733</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;I have loaded a table into Qlikview which has details of CLOSING stock per "GPClass" Per Branch at week end (Date is contained as number in DateBranch field).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to create records showing these values as OPENING stock in the following week:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Close Stock This Week Becomes Opent Stock Next Week.PNG" class="jive-image image-2" src="/legacyfs/online/91043_Close Stock This Week Becomes Opent Stock Next Week.PNG" style="height: 314px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;My intention was to sort the records by Branch, GPClass and DateBranch.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, for each record, I would lookup the previous GPClass (using Branch_GPClass), and if it is the same as the current Branch_GPClass, then I would create a "OpenStock" record for that DateBranch entry, USING THE GPAmt VALUE FOR THE PREVIOUS ENTRY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it is not the same, I create the same record, but with GPAmt as 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help me write the script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to append the resulting table to the existing field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Spreadsheet attached might provide better understanding.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Joe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jun 2015 20:57:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Open-Stock-Next-Week-from-Close-Stock-This-Week-Peek-or/m-p/834382#M993733</guid>
      <dc:creator>mazacini</dc:creator>
      <dc:date>2015-06-26T20:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: Create Open Stock Next Week from Close Stock This Week (Peek or Previous?)</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Open-Stock-Next-Week-from-Close-Stock-This-Week-Peek-or/m-p/834383#M993734</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;EM&gt;source:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD Branch, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GPClass, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Branch_GPClass, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GPAmt, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GPStat, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DateBranch,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; date(subfield(DateBranch, '.', 1)) as date&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;FROM&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;[Create Opening Stock records from Closing Stock.xlsx]&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;(ooxml, embedded labels, header is 1 lines, table is Sheet1);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;cross:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;load distinct date Resident source;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;join (cross) load distinct Branch_GPClass Resident source;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;left join (cross) load * Resident source;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;DROP Table source;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;final:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;NoConcatenate &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;load *,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; if(Peek(Branch_GPClass)=Branch_GPClass, Peek(GPAmt), 0) as NewGPAmt,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; 'Open Stk' as NewGPStat&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Resident cross&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;order by Branch_GPClass, date;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;DROP Table cross;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jun 2015 22:21:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Open-Stock-Next-Week-from-Close-Stock-This-Week-Peek-or/m-p/834383#M993734</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2015-06-26T22:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: Create Open Stock Next Week from Close Stock This Week (Peek or Previous?)</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Open-Stock-Next-Week-from-Close-Stock-This-Week-Peek-or/m-p/834384#M993735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Massimo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The solution you offer correctly calculates the new Opening Stock figure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I need the new data to be in the same format as the existing data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In other words, a new record is created for each line, with new value showing your closing stock calculation in GPAmt, and with the value "Close Stk" in GPStat&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attached spreadsheet illustrates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Joe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jun 2015 22:49:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Open-Stock-Next-Week-from-Close-Stock-This-Week-Peek-or/m-p/834384#M993735</guid>
      <dc:creator>mazacini</dc:creator>
      <dc:date>2015-06-26T22:49:49Z</dc:date>
    </item>
    <item>
      <title>Re: Create Open Stock Next Week from Close Stock This Week (Peek or Previous?)</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Open-Stock-Next-Week-from-Close-Stock-This-Week-Peek-or/m-p/834385#M993736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;IMG alt="1.png" class="jive-image image-1" height="191" src="https://community.qlik.com/legacyfs/online/91066_1.png" style="height: 191.133870967742px; width: 693px;" width="693" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jun 2015 23:05:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Open-Stock-Next-Week-from-Close-Stock-This-Week-Peek-or/m-p/834385#M993736</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2015-06-26T23:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: Create Open Stock Next Week from Close Stock This Week (Peek or Previous?)</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Open-Stock-Next-Week-from-Close-Stock-This-Week-Peek-or/m-p/834386#M993737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Massimo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That worked!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One clarification - I wanted to retain the "Close Stk" data. To achieve this, I just reloaded the original data at the end of the script. You might be able to suggest a better way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to understand the reason for the creation of the "cross" table. I suspect it is something to do with arranging the data to allow for the operation of the Previous statement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think I am confused as to the nature of a Resident Load - is it the case that the data loads in reverse?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you get time to respond, that would be great.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If not, thank you for your help so far.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will mark your answer as correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Joe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Jun 2015 13:18:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Open-Stock-Next-Week-from-Close-Stock-This-Week-Peek-or/m-p/834386#M993737</guid>
      <dc:creator>mazacini</dc:creator>
      <dc:date>2015-06-27T13:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: Create Open Stock Next Week from Close Stock This Week (Peek or Previous?)</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Open-Stock-Next-Week-from-Close-Stock-This-Week-Peek-or/m-p/834387#M993738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px; line-height: 1.5em;"&gt;The below script is easier, without join (no cross table)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In bold 2 of the original fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Resident load: is a load from a previously loaded table; after you load from the excel you can do a resident load from the source table.&lt;/P&gt;&lt;P&gt;Here I used it because I need an ordered load&amp;nbsp; ( by Branch_GPClass, date) and in QlikView you can only&amp;nbsp; do an ordered load using a resident load (if you add an order in the load from excel you get an error, bold)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;More on load&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/docs/DOC-5698"&gt;LOAD data into QlikView&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Directory;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;source:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD Branch, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GPClass, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Branch_GPClass, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GPAmt, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GPStat, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DateBranch,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; date(subfield(DateBranch, '.', 1)) as date&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;FROM&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;[Create Opening Stock records from Closing Stock.xlsx]&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;(ooxml, embedded labels, header is 1 lines, table is Sheet1)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;// order by &lt;/STRONG&gt;&lt;EM style="font-size: 13.3333330154419px;"&gt;&lt;STRONG&gt;order by Branch_GPClass, date&amp;nbsp; --&amp;gt; error&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;final:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;NoConcatenate &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;load &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Branch, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GPClass, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Branch_GPClass, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GPAmt as OriginalGPAmt,&amp;nbsp;&amp;nbsp;&amp;nbsp; // original data&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp; GPStat as OriginalGPStat,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // original data&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DateBranch,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; if(Previous(Branch_GPClass)=Branch_GPClass, Previous(GPAmt), 0) as GPAmt,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; 'Open Stk' as GPStat&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Resident source&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;order by Branch_GPClass, date;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;DROP Table source;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Jun 2015 13:52:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Open-Stock-Next-Week-from-Close-Stock-This-Week-Peek-or/m-p/834387#M993738</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2015-06-27T13:52:40Z</dc:date>
    </item>
    <item>
      <title>Re: Create Open Stock Next Week from Close Stock This Week (Peek or Previous?)</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Open-Stock-Next-Week-from-Close-Stock-This-Week-Peek-or/m-p/834388#M993739</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think I understand.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So you need to load the data in such a way that the Previous statement can work as required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanlks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Joe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Jun 2015 13:57:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Open-Stock-Next-Week-from-Close-Stock-This-Week-Peek-or/m-p/834388#M993739</guid>
      <dc:creator>mazacini</dc:creator>
      <dc:date>2015-06-27T13:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: Create Open Stock Next Week from Close Stock This Week (Peek or Previous?)</title>
      <link>https://community.qlik.com/t5/QlikView/Create-Open-Stock-Next-Week-from-Close-Stock-This-Week-Peek-or/m-p/834389#M993740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;yes,&lt;/P&gt;&lt;P&gt;ordered by Branch_GPClass and date, so you can get (with previous or peek) the amount of the previous record&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Jun 2015 14:08:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Create-Open-Stock-Next-Week-from-Close-Stock-This-Week-Peek-or/m-p/834389#M993740</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2015-06-27T14:08:06Z</dc:date>
    </item>
  </channel>
</rss>

