Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello good day. I have a little case
As you can see in the image, I have a table with a set of id and dates, I am focused on the blue column "price_availability" since I need to take the previous value in a new column "Target" (in green color), I thought to use the previous () or peek () functions would be enough, but it doesn't work for me, you can see the last two columns, not the results.
Any ideas how to get the result I'm looking for? Any contribution is valuable, thanks.
You can try to do the previous function in your load like this. In a new section in the data load editor, loaded after your original table, put the following script:
Newtablename:
Load
*,
Previous(price_availability) as previous_price
;
Load
*
RESIDENT Original_table_name
Order By orden desc ;
DROP TABLE Original_table_name;
You need to sort your data for peek and previous to work as expected.
So after loading your actual data, take a resident with order by and there perform peek and previous operation
load *,
peek(....
Resident TableName
order by precio_fecha,orden;
drop table TableName;