Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I'm trying to create a field in the load script that has the previous value of another field (i.e. "Reserve Amount"). Below is the load script. The result of the load creates the "PreviousReserve" field that is just the same number down the column. See attached spreadsheet of an export of the Qlik Sense table. I've reviewed other posts on this topic. They seem to address Previous function issues where there is just one dimension. My issue has 4 dimensions. I'm assuming this is the area why the Previous function is not working, but I'm not 100% sure.
Any help would be very much appreciated!
Load Script:
ReserveAcrossTimeData:
LOAD
"Reserve Type",
"Change Date",
"Reserve Amount",
"claimid",
"ReserveHistoryID"
FROM [lib://QVD /ReserveAcrossTimeData.qvd] (qvd);
PreviousReserve:
Load claimid,
Previous("Reserve Amount") As "PreviousReserve"
Resident ReserveAcrossTimeData
Order by ReserveHistoryID,"Change Date",claimid,"Reserve Type" desc;
The number of fields within a load with previous() isn't important but the order by statement is essential which is executed from left to the right. Therefore I suggest to check this order if it really matched to your expectation.
- Marcus
Hi Marcus,
Thank you. The order by statement in the load script has the fields that make up a unique record per row (i.e.ReserveHistoryID,"Change Date",claimid,"Reserve Type" ) as the sort sequence for the Previous("Reserve Amount") calculation. The resulting previous reserve amount is the same number for each row as show in the attached spreadsheet. Not sure why this is happening. Have you seen this issue before?
Thanks again,