<?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: Stock calculation with nested IFs in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Stock-calculation-with-nested-IFs/m-p/1578493#M42166</link>
    <description>&lt;P&gt;HI Valpassos,&lt;/P&gt;&lt;P&gt;What it is doing is as follows:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;IF(ID_Company=Previous(ID_Company),
// it will check, on the row, if the company name on that row is the same as the company name on the previous row. Say, on row 10 you have company XYZ, it will check if on row 9, the company is also called XYZ. If not, it will return the Final Stock.

   IF(Reference=Previous(Reference),
For this part the same, as it will check the reference.

      IF(Warehouse=Previous(Warehouse),
Then also for this part where it will check the warehouse name.

           Peek("Final Stock")-Peek("Stock Flows"),
Now it will check with peek for the result of this function, called Final Stock. It will now subtract the Stock Flows.

           "Final Stock"),
If the warehouse name is not the same, it will return the Final Stock.

      "Final Stock"),
If the reference name is not the same, it will return the Final Stock.

   "Final Stock")
If the ID_Company name is not the same, it will return the Final Stock.
                                                                                                  AS "Final Stock"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jordy&lt;/P&gt;&lt;P&gt;Climber&lt;/P&gt;</description>
    <pubDate>Thu, 09 May 2019 13:52:32 GMT</pubDate>
    <dc:creator>JordyWegman</dc:creator>
    <dc:date>2019-05-09T13:52:32Z</dc:date>
    <item>
      <title>Stock calculation with nested IFs</title>
      <link>https://community.qlik.com/t5/App-Development/Stock-calculation-with-nested-IFs/m-p/1578478#M42163</link>
      <description>&lt;P&gt;Hi community,&lt;/P&gt;&lt;P&gt;I have the following piece of code:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;IF(ID_Company=Previous(ID_Company),&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;IF(Reference=Previous(Reference),&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; IF(Warehouse=Previous(Warehouse),&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Peek("Final Stock")-Peek("Stock Flows"),&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"Final Stock"),&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; "Final Stock"),&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;"Final Stock")&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; &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; AS "Final Stock",&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;IF(ID_Company=Previous(ID_Company),&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;IF(Reference=Previous(Reference),&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; IF(Warehouse=Previous(Warehouse),&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Peek("Final Stock")-Peek("Stock Flows"),&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Final Stock"),&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;"Final Stock"),&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; "Final Stock") - "Stock Flows"&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AS "Initial Stock"&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;Could someone please explain to me, in verbose mode, what this piece of script is doing?&lt;BR /&gt;I know it's calculating the Initial Stock based on Final Stock, but I don't entirely understand the &lt;STRONG&gt;if-else logic&lt;/STRONG&gt;. There is way too else conditions.&lt;BR /&gt;For instance: there is a else condition "Final Stock" for each IF, but what is this doing, functionally?&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 05:53:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Stock-calculation-with-nested-IFs/m-p/1578478#M42163</guid>
      <dc:creator>valpassos</dc:creator>
      <dc:date>2024-11-16T05:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: Stock calculation with nested IFs</title>
      <link>https://community.qlik.com/t5/App-Development/Stock-calculation-with-nested-IFs/m-p/1578493#M42166</link>
      <description>&lt;P&gt;HI Valpassos,&lt;/P&gt;&lt;P&gt;What it is doing is as follows:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;IF(ID_Company=Previous(ID_Company),
// it will check, on the row, if the company name on that row is the same as the company name on the previous row. Say, on row 10 you have company XYZ, it will check if on row 9, the company is also called XYZ. If not, it will return the Final Stock.

   IF(Reference=Previous(Reference),
For this part the same, as it will check the reference.

      IF(Warehouse=Previous(Warehouse),
Then also for this part where it will check the warehouse name.

           Peek("Final Stock")-Peek("Stock Flows"),
Now it will check with peek for the result of this function, called Final Stock. It will now subtract the Stock Flows.

           "Final Stock"),
If the warehouse name is not the same, it will return the Final Stock.

      "Final Stock"),
If the reference name is not the same, it will return the Final Stock.

   "Final Stock")
If the ID_Company name is not the same, it will return the Final Stock.
                                                                                                  AS "Final Stock"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jordy&lt;/P&gt;&lt;P&gt;Climber&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 13:52:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Stock-calculation-with-nested-IFs/m-p/1578493#M42166</guid>
      <dc:creator>JordyWegman</dc:creator>
      <dc:date>2019-05-09T13:52:32Z</dc:date>
    </item>
    <item>
      <title>Re: Stock calculation with nested IFs</title>
      <link>https://community.qlik.com/t5/App-Development/Stock-calculation-with-nested-IFs/m-p/1578588#M42187</link>
      <description>&lt;P&gt;Exactly I was looking for!&lt;/P&gt;&lt;P&gt;Thanks,&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/4683"&gt;@JordyWegman&lt;/a&gt;!&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 16:04:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Stock-calculation-with-nested-IFs/m-p/1578588#M42187</guid>
      <dc:creator>valpassos</dc:creator>
      <dc:date>2019-05-09T16:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: Stock calculation with nested IFs</title>
      <link>https://community.qlik.com/t5/App-Development/Stock-calculation-with-nested-IFs/m-p/1582111#M42545</link>
      <description>&lt;P&gt;&lt;STRONG&gt;[REOPENED]&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;I have still another question to make regarding this issue.&lt;/P&gt;&lt;P&gt;We have this structure:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;IF(ID_Company=Previous(ID_Company),&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; IF(Reference=Previous(Reference),&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IF(Warehouse=Previous(Warehouse),&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Peek("Final Stock")-Peek("Stock Flows"),&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; "Final Stock"),&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;"Final Stock"),&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;"Final Stock")&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AS "Final Stock"&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;How different is this IF chain from doing:&lt;BR /&gt;&lt;STRONG&gt;IF(ID_Company=Previous(ID_Company)&lt;BR /&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;FONT color="#FF6600"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;AND&lt;/FONT&gt; Reference=Previous(Reference)&lt;BR /&gt;&lt;FONT color="#FF6600"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;AND&lt;/FONT&gt; Warehouse=Previous(Warehouse),... ?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;When we do an IF for each condition, do all the 3 IFs need to happen (intersection) in order to do the peek()?&lt;/P&gt;&lt;P&gt;Thanks once again community,&lt;/P&gt;&lt;P&gt;Lisa&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2019 11:02:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Stock-calculation-with-nested-IFs/m-p/1582111#M42545</guid>
      <dc:creator>valpassos</dc:creator>
      <dc:date>2019-05-20T11:02:15Z</dc:date>
    </item>
    <item>
      <title>Re: Stock calculation with nested IFs</title>
      <link>https://community.qlik.com/t5/App-Development/Stock-calculation-with-nested-IFs/m-p/1582133#M42548</link>
      <description>&lt;P&gt;Hi Lisa,&lt;/P&gt;&lt;P&gt;This would result in the same answer. So you can use both if you want. And yes, all happen in that order, but also for your&amp;nbsp; 'AND' function.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jordy&lt;/P&gt;&lt;P&gt;Climber&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2019 11:23:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Stock-calculation-with-nested-IFs/m-p/1582133#M42548</guid>
      <dc:creator>JordyWegman</dc:creator>
      <dc:date>2019-05-20T11:23:21Z</dc:date>
    </item>
    <item>
      <title>Re: Stock calculation with nested IFs</title>
      <link>https://community.qlik.com/t5/App-Development/Stock-calculation-with-nested-IFs/m-p/1582239#M42563</link>
      <description>&lt;P&gt;Alright!&lt;/P&gt;&lt;P&gt;Many thanks for the prompt reply,&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/4683"&gt;@JordyWegman&lt;/a&gt;&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Lisa&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2019 13:47:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Stock-calculation-with-nested-IFs/m-p/1582239#M42563</guid>
      <dc:creator>valpassos</dc:creator>
      <dc:date>2019-05-20T13:47:11Z</dc:date>
    </item>
  </channel>
</rss>

