
Re: Loop or geometric series
Andrey Khoronenko Apr 13, 2017 6:19 AM (in response to Akl Kallassi)Hi Akl,
If the calculation is performed for a small amount of data, I do not see any fundamental difference.
But in general it's just interesting, why do not you want to use functions PV or FV?
Regards,
Andrey

Re: Loop or geometric series
Akl Kallassi Apr 13, 2017 9:37 AM (in response to Andrey Khoronenko)Hi Andrey,
What if the calculation is being performed or a large amount of data?
I am very new to qlik sense and that's why I am asking.
As for not using PV or FV functions, there isn't any reason. I will be using them in my codes but for this one specific script I don't want to use them because it would be easier to manipulate the whole equation using the summation or loop. (it is a specific case)

Re: Loop or geometric series
Andrey Khoronenko Apr 13, 2017 10:58 AM (in response to Akl Kallassi)Like an idea, please see this files Yandex.Disk andYandex.Disk (for some reason they could not be attached here). In them, I tried to simulate the settlement process for your both options. For 10 million lines, the calculation the first option was a little faster.
You can replace the calculation in this model with another one and again measure the result by reloading the data. The number of downloadable records can be changed.
Just in case the script code of the first file
LET vStartLoop=Now();
Table1:
LOAD
RecNo() as LoopID,
5*1.02+5*Pow(1.02,2)+5*Pow(1.02,3)+5*Pow(1.02,4)+5*Pow(1.02,5)+5*Pow(1.02,6)+5*Pow(1.02,7)+5*Pow(1.02,8)+5*Pow(1.02,9)+5*Pow(1.02,10) as ValueLoop
AutoGenerate 10000000;
LET vFinishLoop=Now();
LET vTimeLoop=Time(vFinishLoopvStartLoop);
Result
Tthe script code of the second file
LET vStartGeometric=Now();
Table2:
LOAD
RecNo() as GeometricID,
5*(1.02)*(1 Pow(1.02,10))/(11.02) as ValueGeometric
AutoGenerate 10000000;
LET vFinishGeometric=Now();
LET vTimeGeometric=Time(vFinishGeometricvStartGeometric);
Result
Regards,
Andrey

Re: Loop or geometric series
Akl Kallassi Apr 13, 2017 11:00 AM (in response to Andrey Khoronenko)Thank you so much !

Re: Loop or geometric series
Andrey Khoronenko Apr 13, 2017 11:04 AM (in response to Akl Kallassi)I'm glad if something could help you.



