Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Advanced ETL from sequence of events by user_id?

EugeneY
6 - Meteoroid

Hi,

I need help with transforming the input data on sequence of events by user_id into 2 outputs.

Note that number of event per user varies.

See examples if input and expected output below and in attached file:

 

Input spreadsheet

event_iduser_idfrom_statusto_statuscreated_atupdated_at
17active_not_postedactive_posted22:11.822:11.8
2467active_postedfilled06:30.706:30.7
39active_not_postedactive_posted58:18.058:18.0
919active_postedon_hold34:42.734:42.7
17449on_holdcancelled05:27.305:27.3
17469active_not_postedcancelled05:32.205:32.2
17459cancelledactive_not_posted05:29.805:29.8

 

Output1 spreadsheet

user_idEvent_sequenceEventEvent_date
71active_not_posted22:11.8
72active_posted22:11.8
73filled06:30.7
91active_not_posted58:18.0
92active_posted58:18.0
93on_hold34:42.7
94cancelled05:27.3
95active_not_posted05:29.8
96cancelled05:32.2

 

Output2 spreadsheet

user_idFull_event_sequenceSequence_startSequence_end
7active_not_posted - active_posted - filled22:11.806:30.7
9active_not_posted - active_posted - on_hold - cancelled - active_not_posted - cancelled58:18.005:32.2

 

 

Thank you,

Eugene

4 REPLIES 4
DavidP
17 - Castor
17 - Castor

Something like this?

 

DavidP_0-1582676154536.pngDavidP_1-1582676188884.png

 

 

danilang
19 - Altair
19 - Altair

hi @EugeneY 

 

Your times have no hour info, so that there's no way to sort the data that will swap event_id 1745 and 1746 to get them in your output order, without swapping event_id 3 and 91 at the same time.  Check the output of @DavidP's workflow where the last 2 items are not in your output order

 

DavidP's outputDavidP's output 

 

Is the Event_ID unique and ascending for each user_ID? If so, you could order by User_Id and then Event_Id giving you the proper order in your output

 

Dan

EugeneY
6 - Meteoroid

Hi Danilang/Castor,

My input data in excel file contains the data with date and hours (e.g., 3/1/2017 4:22:12 PM). I apologize for confusion made by my copy-paste in the body of my question.

To note, user_id and event_id contains unique values where the event_id value is assigned by the application in the ascending order the status change was made and is expected to correlate with time of the change. 

 

Thank you,

Eugene

 

EugeneY
6 - Meteoroid

Hi Dave,

Thanks for your solution. 

To be 100% sure that the sequence of events is captured, I added a sort step with user_id ascending at the first step and  created_at date at the second step.

See my snapshot.

The ETL produces expected results as in the small test sample I shared with you and on my real data set.

 

Appreciate your help,

Eugene

Labels