<?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: Subtract a field value from a different row in the same field in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Subtract-a-field-value-from-a-different-row-in-the-same-field/m-p/804534#M1028303</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually I solved my own problem &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used order bys, Flags and a series of Peek and Previous functions in nested IF statements to look back at previously loaded records and subtract the Payment amounts from Debt amounts (starting from the oldest debt) and gradually using up all the payments.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am attaching in case anyone needs it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if You can suggest a nicer solution with Loops, etc, I am still open for it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;DATA2 is the solution:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Pic2.png" class="image-1 jive-image" src="https://community.qlik.com/legacyfs/online/79450_Pic2.png" style="width: 620px; height: 383px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 27 Feb 2015 17:45:45 GMT</pubDate>
    <dc:creator>kavicsgym</dc:creator>
    <dc:date>2015-02-27T17:45:45Z</dc:date>
    <item>
      <title>Subtract a field value from a different row in the same field</title>
      <link>https://community.qlik.com/t5/QlikView/Subtract-a-field-value-from-a-different-row-in-the-same-field/m-p/804533#M1028302</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin: 0cm 0cm 10pt;"&gt;&lt;SPAN lang="EN-US" style="mso-ansi-language: EN-US;"&gt;Hi All, &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 10pt;"&gt;&lt;SPAN style="font-family: Times New Roman;"&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="mso-ansi-language: EN-US;"&gt; I have Customer IDs, Aging groups (0, 1-30, 31-90, etc.) and Amounts (fieldname: Data) in the different age groups. (Accounts Receivables)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN lang="EN-US" style="mso-ansi-language: EN-US;"&gt;I have negative and positive amounts. Neg. amounts are PAYMENTS, Pos. amounts are DEBTS!&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 10pt;"&gt;&lt;SPAN style="font-family: Times New Roman;"&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="mso-ansi-language: EN-US;"&gt;I should subtract the Negative amounts from the Positive amount found in the oldest Age category for the same CustID (it is actually Adding, not deducting +10-15). If the Positive amount was less than the Negative, the Remaining Neg amount I should subtract from the Positive Amount found in the next Age category for the same Cust Id. And so on, as long the Sum of Neg amount is fully subtracted.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 10pt;"&gt;&lt;SPAN style="font-family: Times New Roman;"&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="mso-ansi-language: EN-US;"&gt;Thanks a lot! Kavics&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="mso-ansi-language: EN-US;"&gt;&lt;IMG alt="Pic.png" class="image-1 jive-image" src="https://community.qlik.com/legacyfs/online/79429_Pic.png" style="height: auto;" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Feb 2015 11:51:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Subtract-a-field-value-from-a-different-row-in-the-same-field/m-p/804533#M1028302</guid>
      <dc:creator>kavicsgym</dc:creator>
      <dc:date>2015-02-27T11:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: Subtract a field value from a different row in the same field</title>
      <link>https://community.qlik.com/t5/QlikView/Subtract-a-field-value-from-a-different-row-in-the-same-field/m-p/804534#M1028303</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually I solved my own problem &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used order bys, Flags and a series of Peek and Previous functions in nested IF statements to look back at previously loaded records and subtract the Payment amounts from Debt amounts (starting from the oldest debt) and gradually using up all the payments.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am attaching in case anyone needs it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if You can suggest a nicer solution with Loops, etc, I am still open for it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;DATA2 is the solution:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Pic2.png" class="image-1 jive-image" src="https://community.qlik.com/legacyfs/online/79450_Pic2.png" style="width: 620px; height: 383px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Feb 2015 17:45:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Subtract-a-field-value-from-a-different-row-in-the-same-field/m-p/804534#M1028303</guid>
      <dc:creator>kavicsgym</dc:creator>
      <dc:date>2015-02-27T17:45:45Z</dc:date>
    </item>
  </channel>
</rss>

