Alteryx Designer Desktop Discussions

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

I need help with an IF statement. I have tried many options but it is not working as....

Marcegon
8 - Asteroid

Hi, the IF statement below, is giving me "0" even if the [Involvement] field is not Total.  I would like to say ELSE don't do anything instead of "blank".  I added ELSE [Budget], but it does not work since Budget is an added column, not part of the report.  Any help would be greatly appreciated!    

 

IF CONTAINS([Attachments],"budget estimate") OR CONTAINS([Attachments], "estimated budget") OR CONTAINS([Attachments], "budget and") OR CONTAINS([Attachments], "budget_") THEN "Completed" ELSEIF [Involvement] = "Total" AND !CONTAINS([Budget Approver], "spend")AND !CONTAINS([Attachments],"budget estimate") OR !CONTAINS([Attachments], "estimated budget") OR !CONTAINS([Attachments], "budget and") OR !CONTAINS([Attachments], "budget_") AND DATETIMEPARSE([End_date], "%Y-%m-%d") <= DATETIMEADD(DATETIMENOW(), -7, "days") THEN "0" ELSE "blank" ENDIF

 

5 REPLIES 5
Emmanuel_G
13 - Pulsar

@Marcegon 

 

To do not anything, did you try ELSE "" ENDIF instead of ELSE "blank" ENDIF ?

DataNath
17 - Castor

It's a fairy big formula to deconstruct so I might be targeting the wrong part specifically, but I think you need to wrap part of the ELSEIF section in some additional brackets so that the !Contains checks are checked alongside the [Involvement] being total rather than just one or the other needing to be satisfied to give 0 as an answer. Without some data to test against it's hard to be confident but can you try something like the following? I've also changed the 'blank' to null() so that it'll just leave a blank cell if not satisfied at all.

 

IF CONTAINS([Attachments],"budget estimate")

OR CONTAINS([Attachments], "estimated budget")

OR CONTAINS([Attachments], "budget and")

OR CONTAINS([Attachments], "budget_") THEN "Completed"

 

ELSEIF [Involvement] = "Total"

AND !CONTAINS([Budget Approver], "spend")

AND (!CONTAINS([Attachments],"budget estimate")

OR !CONTAINS([Attachments], "estimated budget")

OR !CONTAINS([Attachments], "budget and")

OR !CONTAINS([Attachments], "budget_"))

AND DATETIMEPARSE([End_date], "%Y-%m-%d") <= DATETIMEADD(DATETIMENOW(), -7, "days") THEN "0" ELSE null() ENDIF

Marcegon
8 - Asteroid

Thank you!  It worked.  However, I keep getting "0" if the involvement is not Total.  Is there something I am not seeing in my IF statement?  

grazitti_sapna
17 - Castor

@Marcegon , the issue is we have OR statements in the same ELSEIF and so it is giving "0" even when 1st condition is False Because your OR condition is TRUE in one of the rest conditions.

Sapna Gupta
Marcegon
8 - Asteroid

It worked!  Thank you so much.  Do you give private classes?  I would be willing to pay for one on one classes and solve some the issues I am encountering.  I am new in Alteryx as you can see.  Thanks again

Labels