<?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 I have a problem with calculating a field. Please help in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/I-have-a-problem-with-calculating-a-field-Please-help/m-p/311345#M114905</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is the situation. &lt;/P&gt;&lt;P&gt;We have several 'Products' in a table. For each product there are orders in table 'Orders' that have quantity and date. Each product also have a have 'In stock quantity'. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the orders are more than the stock quantity then in a moment of time the orders can't be fullfilled because we are out of stock. I need to have a table that shows&lt;/P&gt;&lt;P&gt;'Product - Date when we are out of stock'. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have succesfully done it in the load script calculating the in stock quantity after each order and I have this date. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is that now I want to have input fields where I can input a change in the order quantity. When the order quantities change the Date when we are out of stock should be recalclulated. That's why I can't use the one that I have found in the load script and I have to do it in a table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think I need a table that have Product as dimension and expression should be something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;min(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; aggr(&amp;nbsp;&amp;nbsp;&amp;nbsp; if( [Stock Quantity] - sum({&amp;lt;[Order Date]={'&amp;lt;=$(=[Order Date])'} &amp;gt;}quantity) &amp;lt;0, [Order Date], null() )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , [Order Date])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I try to aggregate by date and if the quantity for the current&amp;nbsp; and all the previous dates is more than the stock quantity to return the date. In the end get the first date. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately it doesn't work. I tried some other ideas with rangesum etc because I think the problem might be in the set analysis but none worked. Please help because I am almost out of ideas.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe it should be possible to make such table if I have the data.&lt;/P&gt;&lt;P&gt;-------------------- &lt;/P&gt;&lt;P&gt;Here I added a sample file. I have two tables. The top one shows products. The bottom one shows orders and have input field. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want the top one to show me the date when the product will go out of stock and when I make changes in the order below this date should change also.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the example for Product 1 it should show 1.1.2011 and for Product 2 it is 1.2.2011&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 May 2011 07:31:31 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-05-19T07:31:31Z</dc:date>
    <item>
      <title>I have a problem with calculating a field. Please help</title>
      <link>https://community.qlik.com/t5/QlikView/I-have-a-problem-with-calculating-a-field-Please-help/m-p/311345#M114905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is the situation. &lt;/P&gt;&lt;P&gt;We have several 'Products' in a table. For each product there are orders in table 'Orders' that have quantity and date. Each product also have a have 'In stock quantity'. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the orders are more than the stock quantity then in a moment of time the orders can't be fullfilled because we are out of stock. I need to have a table that shows&lt;/P&gt;&lt;P&gt;'Product - Date when we are out of stock'. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have succesfully done it in the load script calculating the in stock quantity after each order and I have this date. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is that now I want to have input fields where I can input a change in the order quantity. When the order quantities change the Date when we are out of stock should be recalclulated. That's why I can't use the one that I have found in the load script and I have to do it in a table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think I need a table that have Product as dimension and expression should be something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;min(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; aggr(&amp;nbsp;&amp;nbsp;&amp;nbsp; if( [Stock Quantity] - sum({&amp;lt;[Order Date]={'&amp;lt;=$(=[Order Date])'} &amp;gt;}quantity) &amp;lt;0, [Order Date], null() )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , [Order Date])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I try to aggregate by date and if the quantity for the current&amp;nbsp; and all the previous dates is more than the stock quantity to return the date. In the end get the first date. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately it doesn't work. I tried some other ideas with rangesum etc because I think the problem might be in the set analysis but none worked. Please help because I am almost out of ideas.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe it should be possible to make such table if I have the data.&lt;/P&gt;&lt;P&gt;-------------------- &lt;/P&gt;&lt;P&gt;Here I added a sample file. I have two tables. The top one shows products. The bottom one shows orders and have input field. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want the top one to show me the date when the product will go out of stock and when I make changes in the order below this date should change also.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the example for Product 1 it should show 1.1.2011 and for Product 2 it is 1.2.2011&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 May 2011 07:31:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/I-have-a-problem-with-calculating-a-field-Please-help/m-p/311345#M114905</guid>
      <dc:creator />
      <dc:date>2011-05-19T07:31:31Z</dc:date>
    </item>
    <item>
      <title>I have a problem with calculating a field. Please help</title>
      <link>https://community.qlik.com/t5/QlikView/I-have-a-problem-with-calculating-a-field-Please-help/m-p/311346#M114906</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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Can you please upload the QVW and also describe u r problem in detail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kaushik Solanki&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 May 2011 07:45:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/I-have-a-problem-with-calculating-a-field-Please-help/m-p/311346#M114906</guid>
      <dc:creator>kaushiknsolanki</dc:creator>
      <dc:date>2011-05-19T07:45:20Z</dc:date>
    </item>
    <item>
      <title>I have a problem with calculating a field. Please help</title>
      <link>https://community.qlik.com/t5/QlikView/I-have-a-problem-with-calculating-a-field-Please-help/m-p/311347#M114907</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are there any suggestions? &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 May 2011 14:21:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/I-have-a-problem-with-calculating-a-field-Please-help/m-p/311347#M114907</guid>
      <dc:creator />
      <dc:date>2011-05-25T14:21:53Z</dc:date>
    </item>
  </channel>
</rss>

