Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Formula Help

elclark
8 - Asteroid

Hello,

I'm doing an audit to determine if employees booked flights with an appropriate class of service but I'm running into a situation where even if the class type was not appropriate it is giving the results as YES instead of NO. 

 

I noticed this is only happening for flights that have Economy as the "Appropriate Class based on Grade Level Tier" and only if the "Class Type" was Premium Economy or First, so it seems to be something with that section of the formula. If the "Class Type" was Business, it does accurately give the results as NO but if the  "Class Type" was Premium Economy or First it gives the results as YES instead of NO.

 

Any help on how to fix this would be much appreciated. Below is the formula. Thanks.

 

Was Class Appropriate?

IF [Appropriate Class based on Grade Level Tier]="BUSINESS" AND [Class Type]="BUSINESS" OR [Class Type]="FIRST" OR [Class Type]="PREMIUM ECONOMY" OR [Class Type]="COACH" THEN "YES"

 

ELSEIF [Appropriate Class based on Grade Level Tier]="PREMIUM ECONOMY" AND [Class Type]="PREMIUM ECONOMY" OR [Class Type]="COACH" THEN "YES"

 

ELSEIF [Appropriate Class based on Grade Level Tier]="ECONOMY" AND [Class Type]="COACH" THEN "YES"

ELSE "NO" ENDIF

1 REPLY 1
fmvizcaino
17 - Castor
17 - Castor

Hi @elclark ,

 

The only mistake you made was in your OR clauses, if you want to group all of them together with an AND clause, you need to use parenthesis as below.

IF [Appropriate Class based on Grade Level Tier]="BUSINESS" AND ([Class Type]="BUSINESS" OR [Class Type]="FIRST" OR [Class Type]="PREMIUM ECONOMY" OR [Class Type]="COACH") THEN "YES"

 

ELSEIF [Appropriate Class based on Grade Level Tier]="PREMIUM ECONOMY" AND ([Class Type]="PREMIUM ECONOMY" OR [Class Type]="COACH") THEN "YES"

 

ELSEIF [Appropriate Class based on Grade Level Tier]="ECONOMY" AND [Class Type]="COACH" THEN "YES"

ELSE "NO" ENDIF

 

Let me know if this works for you.

Best,

Fernando Vizcaino

Labels