Discussion Board for collaboration on QlikView Scripting.
I have a spreadsheet which requires the next row of data so that I can calculate the closing stock of the day before (i.e. users only input the opening stock per day and thus I need to look at the next days opening stock to calculate the closing stock of the previous day)
|Date||Opening Stock||Closing Stock|
So for the above example for the 27/03/13 I currently only have the opening stock of 5000 inputted and I need to look at the 28/03/13 opening stock in order to complete the closing stock for 27/03/13. Obviously peek could be used if I was looking for the previous value but I'm not sure as to how to look at the next field value.
Solved! Go to Solution.
Load Date(Date#(Date,'DD/MM/YYYY')) as Date,Opening_Stock inline [
Load Date as Date1,Opening_Stock as Opening_Stock1,Previous(Opening_Stock) as ClosingStock
Resident Data Order by Date Desc;
Here because we are sorting the Date in descending order your previous function will act as next.
Try this script
Load Date(Date#(Date,'DD/MM/YYYY')) as Date,ClosingStock inline [
Load Date as Date1,ClosingStock as ClosingStock1,Previous(ClosingStock) as OpeningStock
Resident Data Order by Date Asc;
Try Previous() in script to get previous record field value,
If(RowNo() = 1, OpeningStock, Previous(ClosingStock)) AS OpeningStock
ORDER BY Date;
Hope this helps you.