Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

Using boolean Logic

jonpass
5 - Atom

Hi Everyone, Im new to Alteryx and trying to do a change within one field dependent on a number of the other fields. The formula I have so far is this

 

IIF([ServiceLine] = "Tax" 
AND 
([Sector] = "Life Sciences" OR "Professional Firms & Services" OR "RE, Hospitality & Construction")
AND 
[FSO WAM Filter] = "Other" , "UK Additions - Tax" , [FSO WAM Filter] )

Im looking for all rows where ServiceLine = Tax, FSO WAM Filter = Other and then Sector equals either "Life Sciences" OR "Professional Firms & Services" OR "RE, Hospitality & Construction" but this doesnt seem to work, any ideas?

 

 

Regards

 

Jon

7 REPLIES 7
cbridges
11 - Bolide

Try this:

 

IIF([ServiceLine] = "Tax" 
AND 
([Sector] = "Life Sciences" OR "Professional Firms & Services" OR "RE, Hospitality & Construction")
AND 
[FSO WAM Filter] = "Other")
THEN "UK Additions - Tax"
ELSE [FSO WAM Filter]
ENDIF
@thizviz
JohnJPS
15 - Aurora

Hello Jon! 

 

Would something like this work:

IIF ([ServiceLine] = "Tax" 
AND 
([Sector] IN ("Life Sciences","Professional Firms & Services","RE, Hospitality & Construction"))
AND 
[FSO WAM Filter] = "Other" , "UK Additions - Tax" , [FSO WAM Filter] )

Using "IN"

 

MarqueeCrew
20 - Arcturus
20 - Arcturus
Sector in ("a", "B")

That's a hint
Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
cbridges
11 - Bolide

If that doesn't work, you may need to repeat your OR statements like this (not 100% sure on this):

IIF([ServiceLine] = "Tax"
AND
([Sector] = "Life Sciences" OR
[Sector] ="Professional Firms & Services" OR
[Sector] ="RE, Hospitality & Construction")
AND
[FSO WAM Filter] = "Other")
THEN "UK Additions - Tax"
ELSE [FSO WAM Filter]
ENDIF

 

@thizviz
tom_montpool
12 - Quasar

I agree with repeating the OR statements (or using IN()).

 

Just be sure not to mix up IIF syntax (which doesn't require a then or endif) with IF syntax (which does).

 

IIF syntax:  IIF(Expression, Then, Else)

 

IIF([ServiceLine]=='Tax','Tax','Not Tax')

 

IF syntax: IF Expression THEN Result ELSE Fallback ENDIF

 

IF [ServiceLine]=='Tax' THEN 'Tax' ELSE 'Not Tax' ENDIF

 

cbridges
11 - Bolide

Thanks for the clarification on IIF vs IF! :-)

@thizviz
rohit782192
11 - Bolide

Hi,

 

What the Syntax to take difference in boolean logic.

 

eg:

if Amount 1 == Amount2 

Then True

 

Else 

Amount1=Amount 2

 

I need in iff format as how we write.

 

Same for Date also the Difference.

Labels
Top Solution Authors