Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Indexing Returns

Hi,

I want to get Indexed values in QV but am not able to do so. Would be a great help if someone can help. What I want is explained below as an example.

DayPriceReturnIndex
11000100
2991-0.9%99.1
310101.9%101
410211.1%102.1
510300.9%103

Day & Prices are what I have and rest needs to be done by QV.

1 Solution

Accepted Solutions
d_pranskus
Partner - Creator III
Partner - Creator III

Hi

Use something simmilar:

IF(isnull(Peek('Index')), 100, PEEK('Index')) * (1 + [Expression for the Return Value]) AS Index

Replace [Expression for the Return Value] with your expression.

Cheers

Darius

View solution in original post

8 Replies
d_pranskus
Partner - Creator III
Partner - Creator III

Hi

Could you provide business logic, how to calculate these indexes?

Cheers

Darius

Not applicable
Author

The indexed value would show how much $100 if invested in the commodity grows to after every day.

Formulas for calculations are as under:

Return: today's Price / Yesterday's Price -1

1st Index value = 100 * (1+return)

Subsequent index values: Previous Index value * ( 1+ return)

Not applicable
Author

I am also attaching an excel to showcase the calculations

Not applicable
Author

hi,

i think you can use

load ((price-previous(price))/10) as return in your script



thanks

Not applicable
Author

Hi,

I have already used Peek for calculating returns, Need help with the index part

Not applicable
Author

hi,

the formula for index which you have mentioned previousindex*(1+return)

gives 10 as the second index value

i am not clear as to what exactly u want

to me it seems that you are just dividing the price by 10 to get the index value

pls be a bit more clear

thanks

d_pranskus
Partner - Creator III
Partner - Creator III

Hi

Use something simmilar:

IF(isnull(Peek('Index')), 100, PEEK('Index')) * (1 + [Expression for the Return Value]) AS Index

Replace [Expression for the Return Value] with your expression.

Cheers

Darius

Not applicable
Author

Thanks worked