Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
tsglenn22
Contributor III
Contributor III

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
Gysbert_Wassenaar

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


talk is cheap, supply exceeds demand
swuehl
MVP
MVP

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.