Alteryx Designer Desktop Discussions

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

Multi row flag creation

Inactive User
Not applicable

Hi, 

 

I have to create flags 1/0 for codes based on +/-3 weeks for a given ID and date.

 

For example for 

ID abc and date 1/1/2014-- I need to check if there is any code present in +/-3 days and based on that I have to create flags for ABC. I have attached sample output. 

 

I am not sure what approach to use in this case.

 

Input

 

ID DateDate 2Code 
abc1/1/2014  
abc1/2/2014  
abc1/3/2014  
abc1/4/2014  
abc1/5/2014  
abc1/6/20141/6/2014A
abc1/7/2014  
abc1/8/2014  
abc1/9/2014  
abc1/10/20141/12/2014B
abc1/11/2014  
abc1/12/2014  
abc1/13/2014  
abc1/14/2014  
abc1/15/2014  
abc1/16/2014  
abc1/17/2014  
abc1/18/20141/18/2014C
abc1/19/2014  
abc1/20/2014  
abc1/21/2014  
abc1/22/2014  
abc1/23/2014  
abc1/24/2014  
abc1/25/2014  
abc1/26/2014  
abc1/27/2014  
abc1/28/2014  
abc1/29/2014  
abc1/30/2014  
abc1/31/2014  

 

 

Sample Output 

ID DateABC
abc1/1/2014000
abc1/2/2014000
abc1/3/2014100
abc1/4/2014   
abc1/5/2014   
abc1/6/2014   
abc1/7/2014110
2 REPLIES 2
CharlieS
17 - Castor
17 - Castor

Here's a summary of how I approached this:

- Data prep by formatting the "Date" field as a date field type so datetime formulas could be used.

- Created a list of days that each code should apply to (3 days before/after each code)

- Joined those created code days to the original file and summarized.

 

You mentioned both weeks and days in your example. I used days in my solution, but it is easily edited to work for weeks. Solution attached.

ponraj
13 - Pulsar

Attaching a sample workflow for your case.  Hope this is helpful. 

 

WorkflowWorkflowResultsResults

Labels
Top Solution Authors