<?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: Opening &amp; Closing Stock Month Wise Calculation Issue in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Opening-Closing-Stock-Month-Wise-Calculation-Issue/m-p/527783#M197231</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Set analysis calculates the set once for the entire chart, not per row. So if you want to use Month as a dimension you can't use transaction_date in the set modifier. You'll have to use if statements instead. &lt;/P&gt;&lt;P&gt;sum(if(TRANSACTION_DAY=max(TRANSACTION_DAY),PRIMARY_QUANTITY))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or you can create a flag field to mark the days that are the last day of the month:&lt;/P&gt;&lt;P&gt;if(TRANSACTION_DAY=monthend(TRANSACTION_DAY,1,0) as IsClosingDate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can then use get the closing stock amounts as sum({&amp;lt;IsClosingDate={1}&amp;gt;}PRIMARY_QUANTITY) and the opening stock as above(sum({&amp;lt;IsClosingDate={1}&amp;gt;}PRIMARY_QUANTITY))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 26 Jul 2013 10:35:55 GMT</pubDate>
    <dc:creator>Gysbert_Wassenaar</dc:creator>
    <dc:date>2013-07-26T10:35:55Z</dc:date>
    <item>
      <title>Opening &amp; Closing Stock Month Wise Calculation Issue</title>
      <link>https://community.qlik.com/t5/QlikView/Opening-Closing-Stock-Month-Wise-Calculation-Issue/m-p/527782#M197230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am&amp;nbsp; facing one problem in calculating Opening&amp;nbsp; &amp;amp; Closing Stock, Month Wise in Pivot/Straight Table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Logic For Stock Calculation is as below:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Closing Stock:- suppose i want to get Closing stock&amp;nbsp; for current Month for&amp;nbsp; an itemcode A ,then we have to&amp;nbsp; sum the transaction Filed data&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from Starting date of system to max date of current Month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Opnenig Stock:-suppose i want to get Opening stock for Current Month for an itemcode A,then we have to sum the transaction field data from starting date of &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; system to max date of Previous month&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have written below Calculation in Set Analysis:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Closing Stock:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({$&amp;lt;ITEM_CODE={"A"},TRANSACTION_DATE={"&amp;lt;=$(=num(max(TRANSACTION_DATE)))"},TRANSACTION_DAY=,TRANSACTION_MONTHNAME=&amp;gt;}PRIMARY_QUANTITY)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Opening Stock :-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({$&amp;lt;ITEM_CODE={"A"},TRANSACTION_DATE={"&amp;lt;=$(=num(min(TRANSACTION_DATE)-1))"},TRANSACTION_DAY=,TRANSACTION_MONTHNAME=&amp;gt;}PRIMARY_QUANTITY)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This Calculations Works Fine in Pivot/StraightTable without Month Dimension in it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But we want with Month wise dimension&amp;nbsp; Opening &amp;amp; Closing Stock in Pivot /StraightTable .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help me out for this calculation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Udit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jul 2013 08:29:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Opening-Closing-Stock-Month-Wise-Calculation-Issue/m-p/527782#M197230</guid>
      <dc:creator>udit_kumar_sana</dc:creator>
      <dc:date>2013-07-26T08:29:39Z</dc:date>
    </item>
    <item>
      <title>Re: Opening &amp; Closing Stock Month Wise Calculation Issue</title>
      <link>https://community.qlik.com/t5/QlikView/Opening-Closing-Stock-Month-Wise-Calculation-Issue/m-p/527783#M197231</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Set analysis calculates the set once for the entire chart, not per row. So if you want to use Month as a dimension you can't use transaction_date in the set modifier. You'll have to use if statements instead. &lt;/P&gt;&lt;P&gt;sum(if(TRANSACTION_DAY=max(TRANSACTION_DAY),PRIMARY_QUANTITY))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or you can create a flag field to mark the days that are the last day of the month:&lt;/P&gt;&lt;P&gt;if(TRANSACTION_DAY=monthend(TRANSACTION_DAY,1,0) as IsClosingDate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can then use get the closing stock amounts as sum({&amp;lt;IsClosingDate={1}&amp;gt;}PRIMARY_QUANTITY) and the opening stock as above(sum({&amp;lt;IsClosingDate={1}&amp;gt;}PRIMARY_QUANTITY))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jul 2013 10:35:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Opening-Closing-Stock-Month-Wise-Calculation-Issue/m-p/527783#M197231</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2013-07-26T10:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: Opening &amp; Closing Stock Month Wise Calculation Issue</title>
      <link>https://community.qlik.com/t5/QlikView/Opening-Closing-Stock-Month-Wise-Calculation-Issue/m-p/527784#M197232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But how to get for calculation from starting date to each month end or monthstart with this logic&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2013 09:15:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Opening-Closing-Stock-Month-Wise-Calculation-Issue/m-p/527784#M197232</guid>
      <dc:creator>udit_kumar_sana</dc:creator>
      <dc:date>2013-07-31T09:15:03Z</dc:date>
    </item>
  </channel>
</rss>

