We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Creating a status column off multiple date fields

jrkmorgan
6 - Meteoroid

I need an efficient way to create a singular column for status based off multiple columns with dates. I'm looking for the last non null column and return a status based off of it. A simple sample table.....

I was trying to create the formula with !isNull but it isn't coming out how I need.

 

SPUDCompletionAbandonmentFirst ProdSTATUS
1/1/20232/1/2023 5/1/2023PRODUCING
1/15/20233/1/2023  COMPLETION
1/30/20232/15/20237/1/2023 ABANDONED
6 REPLIES 6
usmanbashir
11 - Bolide

@jrkmorgan 

 

You can also try !isEmpty() function. Depending on how your data is entered, they can be either null, empty, or whitespaces. When i copy and pasted your table in, those 'empty' values actually had whitespaces, so you could use data cleansing to remove whitespace. 

 

I then used below formula to output Status field correctly:

 

IF !isEmpty([First Prod]) THEN 'PRODUCING'
ELSEIF !IsEmpty([Abandonment]) THEN 'ABANDONED'
ELSEIF !IsEmpty([Completion]) THEN 'COMPLETION'
ELSE ''
ENDIF

 

Hope this helps!

 

 

 

jrkmorgan
6 - Meteoroid

I built the table based off the message creation table option - it wasn't the actual table I'm working with.

usmanbashir
11 - Bolide

@jrkmorgan - please see attached workflow. Let me know if this is what you were looking for!

jrkmorgan
6 - Meteoroid

If a certain column is null, it is the prior column's status I need. I.E. if the production date column is empty but completion is not, then the status would be completion. Basically for each row, the header of the column that has the last date.

usmanbashir
11 - Bolide

That's what I built into the workflow. Let me know if results from workflow are not what you're looking for.

 

The workflow attached accommodates for more than just those 3 fields. Since you said that was just sample data, I made the assumption you wanted it more dynamic rather than to create an IF ELSE statement with hardcode column names. The workflow prioritizes the right most column than moves left until a value is found. 

 

From there, you can adjust the workflow as needed.

 

Hope this helps!

HomesickSurfer
12 - Quasar

Hi @jrkmorgan 

 

Here goes...

 

IF 
!IsEmpty([First Prod]) AND !IsNull([First Prod]) THEN 'PRODUCING' ELSEIF 
IsEmpty([First Prod]) OR IsNull([First Prod]) AND !IsEmpty([Abandonment]) OR !IsNull([Abandonment]) THEN 'ABANDONED' 
ELSE 'COMPLETION' 
ENDIF
Labels
Top Solution Authors