Alteryx Designer Desktop Discussions

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

Create new rows with information from previous and next rows

MariusC
5 - Atom

Hello all,

 

I have the following table :

Group_IDStart_TimeEnd_TimeTask_Name
112:00:0013:00:00Task1
113:00:0014:15:00Task2
115:00:0016:00:00Task3
209:00:0010:30:00Task1
213:10:0015:15:00Task2

 

I need to add rows on the following conditions : 

- For each Group, check if there is any "free time" (if End_Time of current row = Start_Time of next row, then there is no free time).

- If there is "free time" between rows, you need to add a new row, where Start_Time = End_Time of previous row, End_Time = Start_Time of next row, and Task_Name = "Free".

 

Based on the example above, the expected result would be : 

 

Group_IDStart_TimeEnd_TimeTask_Name
112:00:0013:00:00Task1
113:00:0014:15:00Task2
114:15:0015:00:00Free
115:00:0016:00:00Task3
209:00:0010:30:00Task1
210:30:0013:10:00Free
213:10:0015:15:00Task2

 

There are a lot more columns (and rows) in the actual dataset, but basically, these are the ones that matter for this case.

 

I have tried to use the "Generate Rows" tool, but can't seem to get the expected result. Does anyone have a similar case ?

2 REPLIES 2
caltang
17 - Castor
17 - Castor

You can consider this:

image.png

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
MariusC
5 - Atom

Yes, thank you ! This should do ! 

 

I really don't get the use of the Generate Rows tool though. Might not be adapted to this specific scenario. 

 

But your answer is great !

Labels