<?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 Cumulative field with recursive function in script in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Cumulative-field-with-recursive-function-in-script/m-p/1810875#M66079</link>
    <description>&lt;P&gt;I am trying to calculate a field in script that depends on its cumulative field.&lt;/P&gt;&lt;P&gt;For each date I receive&amp;nbsp; the target value of the month. And I need to get the target of the day based on how many working days are remaining and based on the cumulative target values from previous days.&lt;/P&gt;&lt;P&gt;I already tried using peek and previous functions and also with AsOf calendar but without success.&lt;/P&gt;&lt;P&gt;The excel file attached has the logic and results expected and the script below has the input data.&lt;/P&gt;&lt;P&gt;It is like: Column 'C' depends on 'A'. 'A' depends on 'B' and 'B' depends on 'C'.&lt;/P&gt;&lt;P&gt;Does anyone can help me?&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;load * inline [&lt;BR /&gt;date,working_days,month_target&lt;BR /&gt;01/05/2021,22,0&lt;BR /&gt;02/05/2021,22,0&lt;BR /&gt;03/05/2021,21,502917&lt;BR /&gt;04/05/2021,20,487102&lt;BR /&gt;05/05/2021,19,485568&lt;BR /&gt;06/05/2021,18,485568&lt;BR /&gt;07/05/2021,17,485568&lt;BR /&gt;08/05/2021,17,0&lt;BR /&gt;09/05/2021,17,0&lt;BR /&gt;10/05/2021,16,485568&lt;BR /&gt;11/05/2021,15,473965&lt;BR /&gt;12/05/2021,14,468302&lt;BR /&gt;13/05/2021,13,468302&lt;BR /&gt;14/05/2021,12,468302&lt;BR /&gt;15/05/2021,12,0&lt;BR /&gt;16/05/2021,12,0&lt;BR /&gt;17/05/2021,11,468302&lt;BR /&gt;18/05/2021,10,469202&lt;BR /&gt;19/05/2021,9,456070&lt;BR /&gt;20/05/2021,8,456070&lt;BR /&gt;21/05/2021,7,456070&lt;BR /&gt;22/05/2021,7,0&lt;BR /&gt;23/05/2021,7,0&lt;BR /&gt;24/05/2021,6,456070&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 30 Nov 2021 18:17:33 GMT</pubDate>
    <dc:creator>igorgois_</dc:creator>
    <dc:date>2021-11-30T18:17:33Z</dc:date>
    <item>
      <title>Cumulative field with recursive function in script</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-field-with-recursive-function-in-script/m-p/1810875#M66079</link>
      <description>&lt;P&gt;I am trying to calculate a field in script that depends on its cumulative field.&lt;/P&gt;&lt;P&gt;For each date I receive&amp;nbsp; the target value of the month. And I need to get the target of the day based on how many working days are remaining and based on the cumulative target values from previous days.&lt;/P&gt;&lt;P&gt;I already tried using peek and previous functions and also with AsOf calendar but without success.&lt;/P&gt;&lt;P&gt;The excel file attached has the logic and results expected and the script below has the input data.&lt;/P&gt;&lt;P&gt;It is like: Column 'C' depends on 'A'. 'A' depends on 'B' and 'B' depends on 'C'.&lt;/P&gt;&lt;P&gt;Does anyone can help me?&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;load * inline [&lt;BR /&gt;date,working_days,month_target&lt;BR /&gt;01/05/2021,22,0&lt;BR /&gt;02/05/2021,22,0&lt;BR /&gt;03/05/2021,21,502917&lt;BR /&gt;04/05/2021,20,487102&lt;BR /&gt;05/05/2021,19,485568&lt;BR /&gt;06/05/2021,18,485568&lt;BR /&gt;07/05/2021,17,485568&lt;BR /&gt;08/05/2021,17,0&lt;BR /&gt;09/05/2021,17,0&lt;BR /&gt;10/05/2021,16,485568&lt;BR /&gt;11/05/2021,15,473965&lt;BR /&gt;12/05/2021,14,468302&lt;BR /&gt;13/05/2021,13,468302&lt;BR /&gt;14/05/2021,12,468302&lt;BR /&gt;15/05/2021,12,0&lt;BR /&gt;16/05/2021,12,0&lt;BR /&gt;17/05/2021,11,468302&lt;BR /&gt;18/05/2021,10,469202&lt;BR /&gt;19/05/2021,9,456070&lt;BR /&gt;20/05/2021,8,456070&lt;BR /&gt;21/05/2021,7,456070&lt;BR /&gt;22/05/2021,7,0&lt;BR /&gt;23/05/2021,7,0&lt;BR /&gt;24/05/2021,6,456070&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2021 18:17:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-field-with-recursive-function-in-script/m-p/1810875#M66079</guid>
      <dc:creator>igorgois_</dc:creator>
      <dc:date>2021-11-30T18:17:33Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative field with recursive function in script</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-field-with-recursive-function-in-script/m-p/1810884#M66080</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/8975"&gt;@igorgois_&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try like below&lt;/P&gt;&lt;P&gt;LOAD Date(Date) as Date,&lt;BR /&gt;Num([Remaining working days]) as [Remaining working days],&lt;BR /&gt;[Month target],&lt;BR /&gt;&lt;STRONG&gt;Alt(Peek('Final Accum'),0)+(If([Month target] = 0, 0, [Month target] - Peek('Final Accum')) / [Remaining working days]) as [Final Accum],&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;If([Month target] = 0, 0, [Month target] - Peek('Final Accum')) / [Remaining working days] as FinalColumn,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;If([Month target] = 0, 0, [Month target] - Peek('Final Accum')) as [Month target Remaining]&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;FROM&lt;BR /&gt;[Cumulative recursive.xlsx]&lt;BR /&gt;(ooxml, embedded labels, header is 2 lines, table is [Target by day]);&lt;/P&gt;&lt;P&gt;o/p:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MayilVahanan_0-1622079162961.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/55778iADE6A9C2D79EEB42/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MayilVahanan_0-1622079162961.png" alt="MayilVahanan_0-1622079162961.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 May 2021 01:33:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-field-with-recursive-function-in-script/m-p/1810884#M66080</guid>
      <dc:creator>MayilVahanan</dc:creator>
      <dc:date>2021-05-27T01:33:09Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative field with recursive function in script</title>
      <link>https://community.qlik.com/t5/App-Development/Cumulative-field-with-recursive-function-in-script/m-p/1811066#M66105</link>
      <description>&lt;P&gt;It worked!!&lt;/P&gt;&lt;P&gt;Thank you so much,&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/17935"&gt;@MayilVahanan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#lifesaver #legend&lt;/P&gt;</description>
      <pubDate>Thu, 27 May 2021 12:56:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Cumulative-field-with-recursive-function-in-script/m-p/1811066#M66105</guid>
      <dc:creator>igorgois_</dc:creator>
      <dc:date>2021-05-27T12:56:48Z</dc:date>
    </item>
  </channel>
</rss>

