<?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 calculate cumulative multiplication? in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/How-to-calculate-cumulative-multiplication/m-p/1742826#M56901</link>
    <description>&lt;P&gt;Try this:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;temp:
LOAD *,
AUTONUMBER(Date &amp;amp; '|' &amp;amp; Product) as ID.#key;

LOAD * INLINE [
Date,Product,Amount
01.01.2019,ProductA,0.2
09.01.2019,ProductA,10
31.01.2019,ProductA,0.5
01.01.2019,ProductB,0.33
14.01.2019,ProductB,10
31.01.2019,ProductB,2
];

//If you need the data for every date in the interval:
tempMissingDates:
LOAD
DATE(MIN(FIELDVALUE('Date',Recno())),'DD.MM.YYYY') AS MinDate,
DATE(MAX(FIELDVALUE('Date',Recno())),'DD.MM.YYYY') AS MaxDate
AUTOGENERATE FIELDVALUECOUNT('Date');

tempMissingDates2:
LOAD
DATE(MinDate +ITERNO()-1,'DD.MM.YYYY') AS Date
RESIDENT tempMissingDates
WHILE MinDate +ITERNO()-1 &amp;lt;= MaxDate;

DROP TABLE tempMissingDates;

//In case you have multiple products:
tempProducts:
LOAD DISTINCT Product RESIDENT temp;

LEFT JOIN (tempMissingDates2) LOAD * RESIDENT tempProducts; DROP TABLE tempProducts;

CONCATENATE (temp)
LOAD
Date,
Product,
[ID2.#key] AS [ID.#key],
1 AS Amount
WHERE NOT EXISTS ([ID.#key],[ID2.#key]);

LOAD
Date,
Product,
AUTONUMBER(Date &amp;amp; '|' &amp;amp; Product) as ID2.#key
RESIDENT tempMissingDates2;

DROP TABLE tempMissingDates2;

temp2:
LOAD *,
Amount as AmountMultipliedCumulative
RESIDENT temp
ORDER BY Product ASC,Date ASC;

DROP TABLE temp;

temp3:
LOAD
Date,
Product,
Amount,
IF(PREVIOUS(Product)=Product,RANGESUM(PEEK(AmountMultipliedCumulative)*AmountMultipliedCumulative),AmountMultipliedCumulative) AS AmountMultipliedCumulative
RESIDENT temp2;

DROP TABLE temp2;&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 10 Sep 2020 12:40:22 GMT</pubDate>
    <dc:creator>RsQK</dc:creator>
    <dc:date>2020-09-10T12:40:22Z</dc:date>
    <item>
      <title>How to calculate cumulative multiplication?</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-calculate-cumulative-multiplication/m-p/1742618#M56868</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd like to calculate the cumulative multiplication..&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;Date, Product, Amount&lt;/P&gt;&lt;P&gt;2019-01-01, ProductA, 0.2&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;2019-01-31, ProductA, 0.5&lt;/P&gt;&lt;P&gt;The calculated field for Product A in Jan 2019 will be 0.2 * .... * 0.5&amp;nbsp;&lt;/P&gt;&lt;P&gt;May I know how can we achieve this? Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Dec 2021 21:08:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-calculate-cumulative-multiplication/m-p/1742618#M56868</guid>
      <dc:creator>gnmq</dc:creator>
      <dc:date>2021-12-20T21:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate cumulative multiplication?</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-calculate-cumulative-multiplication/m-p/1742690#M56878</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;temp:
LOAD *,
AUTONUMBER(Date &amp;amp; '|' &amp;amp; Product) as ID.#key;

LOAD * INLINE [
Date,Product,Amount
01.01.2019,ProductA,0.2
09.01.2019,ProductA,10
31.01.2019,ProductA,0.5
01.01.2019,ProductB,0.33
14.01.2019,ProductB,10
31.01.2019,ProductB,2
];

//If you need the data for every date in the interval:
tempMissingDates:
LOAD
DATE(MIN(FIELDVALUE('Date',Recno())),'DD.MM.YYYY') AS MinDate,
DATE(MAX(FIELDVALUE('Date',Recno())),'DD.MM.YYYY') AS MaxDate
AUTOGENERATE FIELDVALUECOUNT('Date');

tempMissingDates2:
LOAD
DATE(MinDate +ITERNO()-1,'DD.MM.YYYY') AS Date
RESIDENT tempMissingDates
WHILE MinDate +ITERNO()-1 &amp;lt;= MaxDate;

DROP TABLE tempMissingDates;

//In case you have multiple products:
tempProducts:
LOAD DISTINCT Product RESIDENT temp;

LEFT JOIN (tempMissingDates2) LOAD * RESIDENT tempProducts; DROP TABLE tempProducts;

CONCATENATE (temp)
LOAD
Date,
Product,
[ID2.#key] AS [ID.#key],
1 AS Amount
WHERE NOT EXISTS ([ID.#key],[ID2.#key]);

LOAD
Date,
Product,
AUTONUMBER(Date &amp;amp; '|' &amp;amp; Product) as ID2.#key
RESIDENT tempMissingDates2;

DROP TABLE tempMissingDates2;

temp2:
LOAD *,
ROWNO() AS Row;

LOAD *,
Amount as AmountMultipliedCumulative
RESIDENT temp
ORDER BY Product ASC,Date ASC;

DROP TABLE temp;

temp3:
LOAD
Date,
Product,
Amount,
IF(PREVIOUS(Product)=Product,RANGESUM(PEEK(AmountMultipliedCumulative)*AmountMultipliedCumulative),AmountMultipliedCumulative) AS AmountMultipliedCumulative
RESIDENT temp2;

DROP TABLE temp2;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 08:05:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-calculate-cumulative-multiplication/m-p/1742690#M56878</guid>
      <dc:creator>RsQK</dc:creator>
      <dc:date>2020-09-10T08:05:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate cumulative multiplication?</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-calculate-cumulative-multiplication/m-p/1742709#M56883</link>
      <description>&lt;P&gt;Weird, already posted once, but the post somehow dissapeared. Anyway, try this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;temp:
LOAD *,
AUTONUMBER(Date &amp;amp; '|' &amp;amp; Product) as ID.#key;

LOAD * INLINE [
Date,Product,Amount
01.01.2019,ProductA,0.2
09.01.2019,ProductA,10
31.01.2019,ProductA,0.5
01.01.2019,ProductB,0.33
14.01.2019,ProductB,10
31.01.2019,ProductB,2
];

//If you need the data for every date in the interval:
tempMissingDates:
LOAD
DATE(MIN(FIELDVALUE('Date',Recno())),'DD.MM.YYYY') AS MinDate,
DATE(MAX(FIELDVALUE('Date',Recno())),'DD.MM.YYYY') AS MaxDate
AUTOGENERATE FIELDVALUECOUNT('Date');

tempMissingDates2:
LOAD
DATE(MinDate +ITERNO()-1,'DD.MM.YYYY') AS Date
RESIDENT tempMissingDates
WHILE MinDate +ITERNO()-1 &amp;lt;= MaxDate;

DROP TABLE tempMissingDates;

//In case you have multiple products:
tempProducts:
LOAD DISTINCT Product RESIDENT temp;

LEFT JOIN (tempMissingDates2) LOAD * RESIDENT tempProducts; DROP TABLE tempProducts;

CONCATENATE (temp)
LOAD
Date,
Product,
[ID2.#key] AS [ID.#key],
1 AS Amount
WHERE NOT EXISTS ([ID.#key],[ID2.#key]);

LOAD
Date,
Product,
AUTONUMBER(Date &amp;amp; '|' &amp;amp; Product) as ID2.#key
RESIDENT tempMissingDates2;

DROP TABLE tempMissingDates2;

temp2:
LOAD *,
ROWNO() AS Row;

LOAD *,
Amount as AmountMultipliedCumulative
RESIDENT temp
ORDER BY Product ASC,Date ASC;

DROP TABLE temp;

temp3:
LOAD
Date,
Product,
Amount,
IF(PREVIOUS(Product)=Product,RANGESUM(PEEK(AmountMultipliedCumulative)*AmountMultipliedCumulative),AmountMultipliedCumulative) AS AmountMultipliedCumulative
RESIDENT temp2;

DROP TABLE temp2;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 08:44:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-calculate-cumulative-multiplication/m-p/1742709#M56883</guid>
      <dc:creator>RsQK</dc:creator>
      <dc:date>2020-09-10T08:44:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate cumulative multiplication?</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-calculate-cumulative-multiplication/m-p/1742826#M56901</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;temp:
LOAD *,
AUTONUMBER(Date &amp;amp; '|' &amp;amp; Product) as ID.#key;

LOAD * INLINE [
Date,Product,Amount
01.01.2019,ProductA,0.2
09.01.2019,ProductA,10
31.01.2019,ProductA,0.5
01.01.2019,ProductB,0.33
14.01.2019,ProductB,10
31.01.2019,ProductB,2
];

//If you need the data for every date in the interval:
tempMissingDates:
LOAD
DATE(MIN(FIELDVALUE('Date',Recno())),'DD.MM.YYYY') AS MinDate,
DATE(MAX(FIELDVALUE('Date',Recno())),'DD.MM.YYYY') AS MaxDate
AUTOGENERATE FIELDVALUECOUNT('Date');

tempMissingDates2:
LOAD
DATE(MinDate +ITERNO()-1,'DD.MM.YYYY') AS Date
RESIDENT tempMissingDates
WHILE MinDate +ITERNO()-1 &amp;lt;= MaxDate;

DROP TABLE tempMissingDates;

//In case you have multiple products:
tempProducts:
LOAD DISTINCT Product RESIDENT temp;

LEFT JOIN (tempMissingDates2) LOAD * RESIDENT tempProducts; DROP TABLE tempProducts;

CONCATENATE (temp)
LOAD
Date,
Product,
[ID2.#key] AS [ID.#key],
1 AS Amount
WHERE NOT EXISTS ([ID.#key],[ID2.#key]);

LOAD
Date,
Product,
AUTONUMBER(Date &amp;amp; '|' &amp;amp; Product) as ID2.#key
RESIDENT tempMissingDates2;

DROP TABLE tempMissingDates2;

temp2:
LOAD *,
Amount as AmountMultipliedCumulative
RESIDENT temp
ORDER BY Product ASC,Date ASC;

DROP TABLE temp;

temp3:
LOAD
Date,
Product,
Amount,
IF(PREVIOUS(Product)=Product,RANGESUM(PEEK(AmountMultipliedCumulative)*AmountMultipliedCumulative),AmountMultipliedCumulative) AS AmountMultipliedCumulative
RESIDENT temp2;

DROP TABLE temp2;&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 10 Sep 2020 12:40:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-calculate-cumulative-multiplication/m-p/1742826#M56901</guid>
      <dc:creator>RsQK</dc:creator>
      <dc:date>2020-09-10T12:40:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate cumulative multiplication?</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-calculate-cumulative-multiplication/m-p/1742829#M56902</link>
      <description>&lt;P&gt;Is this something you need in the script or front end?&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 12:43:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-calculate-cumulative-multiplication/m-p/1742829#M56902</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2020-09-10T12:43:57Z</dc:date>
    </item>
  </channel>
</rss>

