Alteryx Designer Desktop Discussions

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

if statement based on multirow

Inactive User
Not applicable

Hi,

 

I need to create flag based on last 7 days for a given ID and date. Appreciate if you could upload workflow here. 

Also similar to this, I have to calculate separate  flags for 

 

last 14 days 

next 7 days and next 14 days 

 

Input

IDDateDate 2Code
abc1/1/2014  
abc1/2/2014  
abc1/3/2014  
abc1/4/20141/4/2014A
abc1/5/2014  
abc1/6/20141/19/2014A
abc1/7/2014  
abc1/8/2014  
abc1/9/2014  
abc1/10/2014  
abc1/11/2014  
abc1/12/2014  
abc1/13/2014  
abc1/14/2014  
abc1/15/2014  
abc1/16/2014  
abc1/17/20141/19/2014

A

 

 

 Output

IDDateDate 2CodeFlag
abc1/1/2014  A not present in last 7 days
abc1/2/2014  A not present in last 7 days
abc1/3/2014  A not present in last 7 days
abc1/4/20141/4/2014AA present in last 7 days
abc1/5/2014  A present in last 7 days
abc1/6/20141/19/2014AA present in last 7 days
abc1/7/2014  A present in last 7 days
abc1/8/2014  A present in last 7 days
abc1/9/2014  A present in last 7 days
abc1/10/2014  A present in last 7 days
abc1/11/2014  A present in last 7 days
abc1/12/2014  A present in last 7 days
abc1/13/2014  A present in last 7 days
abc1/14/2014  A not present in last 7 days
abc1/15/2014  A not present in last 7 days
abc1/16/2014  A not present in last 7 days
abc1/17/20141/19/2014AA present in last 7 days

 

2 REPLIES 2
BenMoss
ACE Emeritus
ACE Emeritus

The solution provided in this post should be applicable to your problem.

 

Give it a try and let us know if you are successful.

 

If you need any help interpreting it please throw us a question...

 

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Multi-Row-Formula-to-Count-Days-betwee...

 

Ben

danrh
13 - Pulsar

You could do this all in one Multi-Row Formula tool, but it would be kind of messy --- lots of OR statements, and changing it from 7 to 14 days would be a little bit of a job.  I'd suggest breaking it into two tools to make it simpler to build and maintain:

image.png

The Multi-Row Formula simply tracks the last time there was an "A" in the Code column, and then the Formula tool compares each record's date with the last occurrence date.  Changing from 7 to 14 just requires a couple minor changes in the Formula tool.

Labels