Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a dataset containing Order_id, Customer_id, Product_id, Product_name, First_order_date, Category.
First_order_date is the field that stores the customer's first ever order's date.
I need to find customers who bought products from Category X based on their First_order_date.
I also want to append a column to my data which says "Yes" if product on first purchase was from Category X and "No" if it wasn't.
Can Peek() function be used in this case? Can someone help me with the syntax?
Transaction data:
LOAD
Order_id, Customer_id, Product_id, Product_name,
First_order_date,
Category,
IF(Category='X' AND First_order_date .................................... , YesNo_Category_X= 'Yes', 'No' ) as "YesNo_Category_X)
from transactioncsv;
Any help would be greatly appreciated. Thanks a lot in advance.
I think the sample data isn't complete. Is there any other data you'd like to share?
because in what you sent I always see if(category='X','Yes','No'), is there no date for new orders? or if you share other orders from the same customer to see what changes in row.
Can you try this? I am not sure the condition needed on First_order_date
[Transaction data]:
LOAD
Order_id, Customer_id, Product_id, Product_name,
First_order_date,
Category,
IF(Category='X', 'Yes', 'No' ) as YesNo_Category_X
from transactioncsv
;