Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Everyone,
Please help me to find the formula script based on previous row.
Now I want to calculate the stock for all the months and the formula is :
((currentMonthProduction * Previous month stock) + (current month Sell )) / (Previous month production - current month production)
Let me give an example of how the data is
Please help me to write this script?
Thank you
Hi
Based on my understanding, for 1st row, its Production - Sell to get the Stocks. If so, try like below
Load *,
If(Rowno() =1, Production - Sell, ((Production * Peek('StockField')) + (Sell))
/
(Peek('Production') - Production)) as StockField
resident ursource
order by Month;
hi
have you tried to use the function 'peek' -
Peek - script function ‒ Qlik Sense on Windows
yes, but I don't know the combination formula.
Can you write example formula for this?
Fears of a potential economic slowdown are clouding the outlook for value stocks, which have outperformed broader indexes this year in the ...Hyperfund Login
try this -
((currentMonthProduction * Peek('StockField',0,'TableName')) + (current month Sell ))
/
(Peek('productionField',0,'TableName') - current month production)
Hi, try with the previous() function.
Hi Jmartineze,
Can you write the sample combination formula with previous() ?
load
....
((currentMonthProduction * Previous( month stock)) + (current month Sell )) / (Previous( month production) - current month production) as NameField
from Table;
Hi
Based on my understanding, for 1st row, its Production - Sell to get the Stocks. If so, try like below
Load *,
If(Rowno() =1, Production - Sell, ((Production * Peek('StockField')) + (Sell))
/
(Peek('Production') - Production)) as StockField
resident ursource
order by Month;
Hi MendyS,
Thanks for your reply. But its not working for my expectation.