<?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: How to make tables with derived values in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-make-tables-with-derived-values/m-p/1632458#M732482</link>
    <description>&lt;P&gt;Try this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Table:
LOAD * INLINE [
    day, amount_spent
    0, 0
    1, 650000
    2, 500000
    3, 420000
    4, 45000
    5, 750000
    6, 280000
    7, 2000
    8, 25000
];

FinalTable:
LOAD *,
	 //RangeSum(Peek('cum_amt_spent'), amount_spent) as cum_amt_spent,
	 If(day = 0, 1000000, If(RangeSum(Peek('Account'), -amount_spent) &amp;lt; 0, RangeSum(Peek('Account'), -amount_spent, 1000000), RangeSum(Peek('Account'), -amount_spent))) as Account,
	 If(day = 0, 1, If(RangeSum(Peek('Account'), -amount_spent) &amp;lt; 0, RangeSum(Peek('Bucket_No'), 1), Peek('Bucket_No'))) as Bucket_No
Resident Table
Order By day;

DROP Table Table;&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 08 Oct 2019 11:46:17 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2019-10-08T11:46:17Z</dc:date>
    <item>
      <title>How to make tables with derived values</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-make-tables-with-derived-values/m-p/1632435#M732481</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I am trying to do what I thought to be quite simple but after trying to find the resources to answer the question myself I still haven't managed to get it.&lt;/P&gt;&lt;P&gt;I have a date, and an amount of money spent on that date. This money comes out of a pre-allocated amount of money. What I need to do is get a rolling sum of the money left in the pre-allocated amount on a day by day basis. If the amount is depleted I need to allocate the same amount again to the rolling sum, and count how many times in a month a re-allocation has to be done.&lt;/P&gt;&lt;P&gt;I've done it in Excel which was quite easy, I just had an if statement that said&lt;BR /&gt;IF CurrentAccBalance - DailySpend &amp;lt; 0 THEN field=CurrentAccBalance - DailySpend + 1,000,000 ELSE&amp;nbsp; field=CurrentAccBalance - DailySpend&lt;/P&gt;&lt;P&gt;Example below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 617px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/20892i69C45CF7823FDC40/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-make-tables-with-derived-values/m-p/1632435#M732481</guid>
      <dc:creator>freddean</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to make tables with derived values</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-make-tables-with-derived-values/m-p/1632458#M732482</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Table:
LOAD * INLINE [
    day, amount_spent
    0, 0
    1, 650000
    2, 500000
    3, 420000
    4, 45000
    5, 750000
    6, 280000
    7, 2000
    8, 25000
];

FinalTable:
LOAD *,
	 //RangeSum(Peek('cum_amt_spent'), amount_spent) as cum_amt_spent,
	 If(day = 0, 1000000, If(RangeSum(Peek('Account'), -amount_spent) &amp;lt; 0, RangeSum(Peek('Account'), -amount_spent, 1000000), RangeSum(Peek('Account'), -amount_spent))) as Account,
	 If(day = 0, 1, If(RangeSum(Peek('Account'), -amount_spent) &amp;lt; 0, RangeSum(Peek('Bucket_No'), 1), Peek('Bucket_No'))) as Bucket_No
Resident Table
Order By day;

DROP Table Table;&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 08 Oct 2019 11:46:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-make-tables-with-derived-values/m-p/1632458#M732482</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-10-08T11:46:17Z</dc:date>
    </item>
  </channel>
</rss>

