<?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: Help with calculation in load script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Help-with-calculation-in-load-script/m-p/431219#M696221</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Son of Sardar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your input.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not using SQL, just qlikview. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried grouping, however that only gives me the total. Which is fine for totalling allocated stock, but I haven't been successful in getting it to do the cumulative total of orders for a product that preceed this order. I suspect some sort of range sum may be the answer, but I'm inexperienced in using that function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 May 2013 04:33:17 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-05-07T04:33:17Z</dc:date>
    <item>
      <title>Help with calculation in load script</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-calculation-in-load-script/m-p/431217#M696219</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone first time poster here I usually try and search up my own answers, but i've come across a problem that I haven't been able to solve yet and hoping for some help here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Essentially i'm trying to calculate whether a product has sufficient stock in inventory in a load script, it needs to be part of the load script as the result of this calculation (sufficient stock, insufficient stock) will be used as dimensions for analysis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a watered down example, an input table (as a csv) is of the format:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" style="width: 100%; border: 1px solid #000000;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Order Num&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Pr﻿oduct&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Due Date&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Order Qty&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Total Inventory&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;Allocated Batch Num&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;10001&lt;/TD&gt;&lt;TD&gt;APPLE&lt;/TD&gt;&lt;TD&gt;5/5/2013&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;250&lt;/TD&gt;&lt;TD&gt;&lt;BR /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;10002&lt;/TD&gt;&lt;TD&gt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&gt;ORANGE&lt;/TD&gt;&lt;TD&gt;10/5/2013&lt;/TD&gt;&lt;TD&gt;130&lt;/TD&gt;&lt;TD&gt;500&lt;/TD&gt;&lt;TD&gt;&lt;BR /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;10009&lt;/TD&gt;&lt;TD&gt;GRAPE&lt;/TD&gt;&lt;TD&gt;13/5/2013&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;TD&gt;185&lt;/TD&gt;&lt;TD&gt;B200&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;10010&lt;/TD&gt;&lt;TD&gt;GRAPE&lt;/TD&gt;&lt;TD&gt;13/5/2013&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;TD&gt;185&lt;/TD&gt;&lt;TD&gt;B300&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note, total inventory comes in on every order line, but is specific to a product, so there's 250 units of apple in the total inventory.&lt;/P&gt;&lt;P&gt;If a order has an allocated batch number, then it's considered allocated.&lt;/P&gt;&lt;P&gt;Orders are sorted by date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The new calculated field will be called 'Achievable', and values will be 'Sufficient Stock' and 'Insufficient Stock'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By default, anything that has been allocated is achievable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For anything else, the order is acheivable if:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the total inventory minus total allocated stock minus all unallocated orders for that item that occur before the current order is greater than the order quantity of that line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some examples to explain the logic:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;For Order 10005:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Product = Apple&lt;/P&gt;&lt;P&gt;Order Qty = 95&lt;/P&gt;&lt;P&gt;Total Inventory of Apple = 250&lt;/P&gt;&lt;P&gt;Total Allocated Apple = 143&lt;/P&gt;&lt;P&gt;Total unallocated orders of apple that come before order 10005 = 100&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effectively, there's 250 - 143 - 100 = 7 apple available, and therefore order 10005 cannot be fufilled. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;For order 10004:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Product = Grape&lt;/P&gt;&lt;P&gt;Order Qty = 35&lt;/P&gt;&lt;P&gt;Total inventory of grape = 185&lt;/P&gt;&lt;P&gt;Total allocated grape = 100&lt;/P&gt;&lt;P&gt;Total unallocated orders for grape that come before order 10004 = 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effectively there's 185 - 100 - 0 = 85 grape available, therefore order 10004 can be fufilled.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope i posted up enough information for someone to understand what i'm trying to achieve.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance for any assistance.&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 May 2013 01:42:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-calculation-in-load-script/m-p/431217#M696219</guid>
      <dc:creator />
      <dc:date>2013-05-07T01:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: Help with calculation in load script</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-calculation-in-load-script/m-p/431218#M696220</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi John,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First of all if you are using sql statement then plz use functions like ROLLUP()&amp;nbsp; and you can achieve this structure in sql only and if you want it to be done in Qlikview then use group by in load.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 May 2013 04:25:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-calculation-in-load-script/m-p/431218#M696220</guid>
      <dc:creator>sujeetsingh</dc:creator>
      <dc:date>2013-05-07T04:25:20Z</dc:date>
    </item>
    <item>
      <title>Re: Help with calculation in load script</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-calculation-in-load-script/m-p/431219#M696221</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Son of Sardar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your input.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not using SQL, just qlikview. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried grouping, however that only gives me the total. Which is fine for totalling allocated stock, but I haven't been successful in getting it to do the cumulative total of orders for a product that preceed this order. I suspect some sort of range sum may be the answer, but I'm inexperienced in using that function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 May 2013 04:33:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-calculation-in-load-script/m-p/431219#M696221</guid>
      <dc:creator />
      <dc:date>2013-05-07T04:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: Help with calculation in load script</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-calculation-in-load-script/m-p/431220#M696222</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;John.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are searching for cummalative sum then go to this sample well&amp;nbsp; may it help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can use rangesum() function as &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;RangeSum(Sales,peek(date ),date)&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 May 2013 06:44:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-calculation-in-load-script/m-p/431220#M696222</guid>
      <dc:creator>sujeetsingh</dc:creator>
      <dc:date>2013-05-07T06:44:51Z</dc:date>
    </item>
  </channel>
</rss>

