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

MPCNA
8 - Asteroid

If [Business Unit] = "MMB" and [Dollars] > 25000 then [Location] = [Location] else if [Business Unit] = "MMB" and [Dollars] < 7500 then [Location] = "UW" else "Central" endif

 

Error: Formula (35) Parse Error at char(269): Malformed If Statement (Expression #1)

5 REPLIES 5
JohnJPS
15 - Aurora

Hi @MPCNA

With indentation that looks like:

 

If [Business Unit] = "MMB" and [Dollars] > 25000 then 
    [Location] = [Location] 
else 
    if [Business Unit] = "MMB" and [Dollars] < 7500 then 
       [Location] = "UW" 
    else 
       "Central" 
    endif

You may want something more like...

If [Business Unit] = "MMB" and [Dollars] > 25000 then 
    [Location] 
else 
    if [Business Unit] = "MMB" and [Dollars] < 7500 then 
       "UW" 
    else 
       "Central" 
    endif
endif

Hope that helps!

 

MPCNA
8 - Asteroid

Thanks!

MarqueeCrew
20 - Arcturus
20 - Arcturus

@JohnJPS,

 

How about:

 

IF
     [Business Unit] = "MMB" and [Dollars] > 25000 
     THEN [Location] 
ELSEIF 
     [Business Unit] = "MMB" and [Dollars] < 7500 
     THEN "UW" 
ELSE 
     "Central" 
ENDIF

Just a cosmetic difference of style...

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
JohnJPS
15 - Aurora

@MarqueeCrew, as always, I like your style.  C

MPCNA
8 - Asteroid

So my current formula is:

 

Output Column: Location 

If [Business Unit] = "MMB" and [Premium] > 25000 then [Location] else if [Business Unit] = "MMB" and [Premium] < 7500 then "UW" else if [Business Unit] = "MMB" then "Central" else [Location] endif endif endif

 

After running, it is dropping 0's in for anything under 7500 and the elses that should change location to "central" are defaulting to the original location.

 

Any thoughts on what the issue is?

Labels