Alteryx Designer Desktop Discussions

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

Multi Row Formula and loop

Anastasio_Theohari
8 - Asteroid

Hello Guys,

 

Lets say we have an input like this

 

IDStatusStartDateEndDate
20000265Active20001114 
20000265Active20150225 
20000265Active20160330 
20000265Active20160819 
20000265Active20170519 
20000265Active20171129 
20000265Terminated20210205 

 

When i am taking Terminated status and value i want to fill all the previous values with the Terminated_Date-1

So the diserable output will be :

 

IDStatusStartDateEndDate
20000265Active2000111420210204
20000265Active2015022520210204
20000265Active2016033020210204
20000265Active2016081920210204
20000265Active2017051920210204
20000265Active2017112920210204
20000265Terminated20210205 

 

 

Th MultiRowFormula works good with the following exrpession :

 

if ISNULL([EndDate]) and [Row+1:Status]='Active' and [Row+2:Status]='Active' and [Row+3:Status]='Active' and [Row+4:Status]='Active' and [Row+5:Status]='Terminated' then Left(DateTimeAdd([Row+5:TerminationDate_date],-1,'Days'),10)

 

The case here is that i dont know the number of Active i will have when i  take Terminated,so maybe i will more than 10 records or just 3,4 whatever..

 

So,do you know any solution to loop all the Active, group by the ID and fill with TerminationDate-1 if i receive Terminated status...

 

Thank you

4 REPLIES 4
Emil_Kos
17 - Castor
17 - Castor

Hi @Anastasio_Theohari,


I have created a workflow for you:

Emil_Kos_1-1612529640168.png

The output:

Emil_Kos_0-1612529635192.png

 

AngelosPachis
16 - Nebula

Hi @Anastasio_Theohari ,

 

Maybe you can avoid the multi-row formula tool and use a join tool instead to bring the End date for Terminated Status for each ID?

 

EDIT : Looking at Qiu's solution, I realised I forgot to subtract one day from the terminated date. Thanks @Qiu 

 

AngelosPachis_0-1612530396723.png

 

 

Hope that helps, let me know if that worked for you please.

 

Cheers

Angelos

 

Qiu
20 - Arcturus
20 - Arcturus

@Anastasio_Theohari 

Something dynamic for you.

0205-Anastasio_Theohari.PNG

Anastasio_Theohari
8 - Asteroid

Thank you my friend

Labels