<?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 A problem in accessing previous data to calculate recent 1 . in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/A-problem-in-accessing-previous-data-to-calculate-recent-1/m-p/498137#M186158</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Everyone ,&lt;/P&gt;&lt;P&gt;I am creating a forecast table where my table is looking as :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="ForecastTable.png" class="jive-image" src="https://community.qlik.com/legacyfs/online/48750_ForecastTable.png" style="width: 620px; height: 355px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this table my dimension and expression is as follows:&lt;/P&gt;&lt;P&gt;Dimension :- ForecastStock&lt;/P&gt;&lt;P&gt;Expressions are :-&lt;/P&gt;&lt;P&gt;1)=sum(PlannedProduction)&lt;/P&gt;&lt;P&gt;2)=sum(PlannedRecieves)&lt;/P&gt;&lt;P&gt;3)=sum(ActualProduction)&lt;/P&gt;&lt;P&gt;4)=sum(ActualRecieves)&lt;/P&gt;&lt;P&gt;5)=week(DateOfForecast)&lt;/P&gt;&lt;P&gt;6)=if(Week(DateOfForecast)=1,sum({&amp;lt;ProductId={'1'}&amp;gt;}InitialStock)+PlannedProduction+PlannedRecieves-ForecastStock,0)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the question is in 6th expression where i need to calculate in else part instead of 0, the calculation is based on my previous week calculation in this expression itself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eg:&lt;/P&gt;&lt;P&gt;for week 1 i an using the value of initialStock which is present in my database but for week 2 my initialStock will be replaced by the Calculated value for week 1,&lt;/P&gt;&lt;P&gt;Similarly week 3 will use the value of week 2 in calculation... and goes on.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can i pick the previous weeks value for next week where my expression for calculation is same for every week.&lt;/P&gt;&lt;P&gt;Please Help.&lt;/P&gt;&lt;P&gt;Thanks in Advance. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am attaching my file with this:&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 08 Nov 2013 12:24:04 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-11-08T12:24:04Z</dc:date>
    <item>
      <title>A problem in accessing previous data to calculate recent 1 .</title>
      <link>https://community.qlik.com/t5/QlikView/A-problem-in-accessing-previous-data-to-calculate-recent-1/m-p/498137#M186158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Everyone ,&lt;/P&gt;&lt;P&gt;I am creating a forecast table where my table is looking as :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="ForecastTable.png" class="jive-image" src="https://community.qlik.com/legacyfs/online/48750_ForecastTable.png" style="width: 620px; height: 355px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this table my dimension and expression is as follows:&lt;/P&gt;&lt;P&gt;Dimension :- ForecastStock&lt;/P&gt;&lt;P&gt;Expressions are :-&lt;/P&gt;&lt;P&gt;1)=sum(PlannedProduction)&lt;/P&gt;&lt;P&gt;2)=sum(PlannedRecieves)&lt;/P&gt;&lt;P&gt;3)=sum(ActualProduction)&lt;/P&gt;&lt;P&gt;4)=sum(ActualRecieves)&lt;/P&gt;&lt;P&gt;5)=week(DateOfForecast)&lt;/P&gt;&lt;P&gt;6)=if(Week(DateOfForecast)=1,sum({&amp;lt;ProductId={'1'}&amp;gt;}InitialStock)+PlannedProduction+PlannedRecieves-ForecastStock,0)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the question is in 6th expression where i need to calculate in else part instead of 0, the calculation is based on my previous week calculation in this expression itself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eg:&lt;/P&gt;&lt;P&gt;for week 1 i an using the value of initialStock which is present in my database but for week 2 my initialStock will be replaced by the Calculated value for week 1,&lt;/P&gt;&lt;P&gt;Similarly week 3 will use the value of week 2 in calculation... and goes on.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can i pick the previous weeks value for next week where my expression for calculation is same for every week.&lt;/P&gt;&lt;P&gt;Please Help.&lt;/P&gt;&lt;P&gt;Thanks in Advance. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am attaching my file with this:&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Nov 2013 12:24:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/A-problem-in-accessing-previous-data-to-calculate-recent-1/m-p/498137#M186158</guid>
      <dc:creator />
      <dc:date>2013-11-08T12:24:04Z</dc:date>
    </item>
  </channel>
</rss>

