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

Update fileds with Multi rows and Conditional Statement

florita
5 - Atom
Before  AFTER  
TimeDate TimeDate 
13:01:50  13:01:5023/10/2017 
13:01:51  13:01:5123/10/2017 
13:02:29  13:02:2923/10/2017 
13:02:34  13:02:3423/10/2017 
13:02:3523/10/2017 13:02:3523/10/2017 
7:39:33  7:39:3324/10/2017 
7:41:32  7:41:3224/10/2017 
7:43:33  7:43:3324/10/2017 
7:49:3224/10/2017 7:49:3224/10/2017 
9:13:29  9:13:2924/10/2017 

 

I have the above situation (BEFORE) and I want to go to the (AFTER) situation. I am trying to using a multi-row tool. But not going anywhere. 

IF
(ISNULL(TimeStamp)
and TIME<=[Row-1:Time]
AND TIME>00:00:00)
THEN [Row-1:TimeStamp]
ELSEIF
(ISNULL(TimeStamp)
and TIME>[Row-1:Time])
THEN
DateTimeAdd(TimeStamp,-1,"days")
ELSE [TimeStamp]
ENDIF

 

Could you please help me?

Thanks

2 REPLIES 2
gnans19
11 - Bolide

It's better to work from top to bottom. Try sorting in reverse order and apply multirow formula

danrh
13 - Pulsar

I think @gnans19 is correct here, reversing the sort first will make things easier.  So your workflow will end up looking something like this:

image.png

I add a RecordID to maintain the original order, sort, copy down dates into the null rows, sort back to the original, and drop the ID field.  Note that in your sample you have 24/10/2017 on the row next to the last one.  I'm assuming that is either a typo and should be on the last record, or that the last record belongs to the next date (which isn't included in the sample data) and the AFTER portion has a typo.  If that's not true, you might need to get a little fancier with your Multi-Row Formula tool.

 

Hope it helps!

Labels