Alteryx Designer Desktop Discussions

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

Using formula tool to check if one of two columns have a value

wonka1234
10 - Fireball

Hi,

 

I want to do a comparison between two columns.

Ie make a formula to check if  ONLY one of the two columns have a value.

 

Does this make sense? Im not sure if it fully covers the logic because i only want to identify if 1 of them have a value and 1 doesnt as "ERROR" . I do not want to flag if both are Blank then error. Hopefully that makes sense.

 

My formula:

If [Date] = '' OR [Status] = '' then "ERROR" else "" Endif

4 REPLIES 4
FreeRangeDingo
11 - Bolide
11 - Bolide

Instead of using [Date] = '', consider using the IsEmpty or IsNull functions.

 

IsEmpty([Date]) - means is empty

!IsEmpty([Date]) - means is not empty

 

I believe Empty will encompass Null but Null does not include Empty.  They are slightly different functions, and I always use IsEmpty.

wonka1234
10 - Fireball

thanks but not sure if that checks the logic, ERROR if ONE of the TWO columns are Empty.

Felipe_Ribeir0
16 - Nebula

Hi @wonka1234 

 

You can check if your formula works applying it into a dummy dataset that cover all 4 possibilities

 

Felipe_Ribeir0_1-1669745252206.png

I attached a workflow with your formula (does not work) and the proposed formula for you to check out:

 

If (IsNull([Date]) AND !IsNull([Status]))
OR (!IsNull([Date]) AND IsNull([Status]))
then "ERROR"
else Null()
Endif

 

Felipe_Ribeir0_0-1669745460868.png

 

 

 

FreeRangeDingo
11 - Bolide
11 - Bolide

What you want is this....

 

if (

 

if IsEmpty([Date]) then 1 else 0 endif + if IsEmpty([Date2]) then 1 else 0 endif 

 

) =1 then "ERROR" else "OK" endif

 

 

Labels