Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

tsglenn22
New Contributor II

Summation to the n-th period

Hey all, I'm trying to calculate a formula that uses a summation and I don't know the best way to tackle this. I've played around with loops in the load script and using the aggr() function but can't seem to get it right.

I have three variables that I already have calculated: cash flow (CF), interest rate ( i ) and number of periods (n).

The formula mathematically looks like:

Σ ( t * CF) / ((1 + i ) ^ t )

from t=1 to n

If anyone has dealt with this kind of formula before in Qlik I'd greatly appreciate some help. Thank you!

2 Replies

Re: Summation to the n-th period

sum(valueloop(1, n)*CF/pow(1+i),valueloop(1,n))


talk is cheap, supply exceeds demand
MVP
MVP

Re: Summation to the n-th period

You may also want to have a look in the HELP at the Financial Aggregation Functions in Charts,

namely npv() and xnpv() might be of interest.