<?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 Calculating forecast stock in QV Script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Calculating-forecast-stock-in-QV-Script/m-p/293045#M1192778</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Pascal,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;maybe like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I assume that you need the sum of the forecasted production and sales per week, right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could sum this information with loading the resident fact table grouped by week, where Measure_Type = Forecast.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you might load your fact table again and lookup()&amp;nbsp; the forecasted values for the given week.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does this makes sense?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Jul 2011 11:22:23 GMT</pubDate>
    <dc:creator>swuehl</dc:creator>
    <dc:date>2011-07-20T11:22:23Z</dc:date>
    <item>
      <title>Calculating forecast stock in QV Script</title>
      <link>https://community.qlik.com/t5/QlikView/Calculating-forecast-stock-in-QV-Script/m-p/293044#M1192777</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 a design issue and I wondered if someone could help me here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To simplify my structure, I have a fact table containing:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Week&lt;/LI&gt;&lt;LI&gt;Measure_Type (Actual or Forecast)&lt;/LI&gt;&lt;LI&gt;Forecasted Production&lt;/LI&gt;&lt;LI&gt;Forecasted Sales&lt;/LI&gt;&lt;LI&gt;Actual Stock&lt;/LI&gt;&lt;LI&gt;DataSet (the week at which the Forecasted data are available in the system).&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;for each week, we have only one Actual Stock figure&lt;/LI&gt;&lt;LI&gt;for each week, we have several possible Forecasted figures (one for each dataset)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Fact_Table_SOP.jpg" class="jive-image-thumbnail jive-image" onclick="" src="https://community.qlik.com/legacyfs/online/5990_Fact_Table_SOP.jpg" width="450" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once this table loaded, I need to calculate the Forecasted Stock for next weeks. the formula is simple:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Forecasted Stock W3] = [Actual Stock W2] + [Forecasted Production W2] - [Forecasted Sales W2]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I don't know how I can do this. How can I access the data from last week during the script ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried to use a tmp Fact table and to the load it into the final one with a field "NextStock" and the formula:&lt;/P&gt;&lt;P&gt;[Actual Stock] + [Forecasted Production] - [Forecasted Sales]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But as lines are not the same, the forecast line does not find the Actual Stock value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I thought about creating a Mapping table to get the stock, but I have millions of lines and a lot of other dimensions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does someone have an idea on this ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Pascal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2011 09:24:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculating-forecast-stock-in-QV-Script/m-p/293044#M1192777</guid>
      <dc:creator />
      <dc:date>2011-07-20T09:24:30Z</dc:date>
    </item>
    <item>
      <title>Calculating forecast stock in QV Script</title>
      <link>https://community.qlik.com/t5/QlikView/Calculating-forecast-stock-in-QV-Script/m-p/293045#M1192778</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Pascal,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;maybe like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I assume that you need the sum of the forecasted production and sales per week, right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could sum this information with loading the resident fact table grouped by week, where Measure_Type = Forecast.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you might load your fact table again and lookup()&amp;nbsp; the forecasted values for the given week.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does this makes sense?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2011 11:22:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculating-forecast-stock-in-QV-Script/m-p/293045#M1192778</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2011-07-20T11:22:23Z</dc:date>
    </item>
  </channel>
</rss>

