I have a transactional log with one row representing one order. Customers can have multiple orders, or just a single one. I want to figure out the time difference between customers making their first order and 2nd order, ignoring the 3rd/4th/5th etc orders. Some customers have a single order so wouldn't apply, some have like 25 spread over 3 years. I'm really struggling to figure this out, especially as Alteryx seems to be sorting my dates weirdly, despite me ensuring the order date column is recognised as datetime format.
Current data:
Customer ID | Order Date |
10000039 | 30/05/2023 |
10000039 | 01/06/2023 |
10000039 | 08/06/2023 |
10000085 | 20/11/2023 |
10000085 | 02/04/2023 |
The goal:
Customer ID | Days between 1st and 2nd transaction |
10000039 | 9 |
10000085 | 232 |
What do you mean by Alteryx is sorting your dates weirdly? If your dates are in YYYY-MM-DD and you're sorting by CustomerID and Date, the difference between the 1st and 2nd record for each customer will give you what you're looking for.
BTW for customer 10000039, the difference between the 1st and 2nd order is only 3 days(2 if you're exclusive of the first date). May 30-Jun 01
Dan
@SophieRawcliffe
please find the workflow attached
mark done if solved.
@danilang
As per my understanding from the output data attached, he is trying to calculate the difference between 1st and last order.
Regards,
Raj