Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

If contains formula with subtraction

geeklarokcmie
8 - Asteroid
Column AAtypeAmnt
123GPP40.56
456CBB40.51
789GPP30.0
101CBB80.00
102AAP9.00
103AKS7.00

 

What can be the forumla for the below requirement:

 

The net ‘Amnt’  where the net equals any Atype containing GPP and CBB minus all others

 

  • I tried the below but I was told that it's backwards and adding +1

 

If Contains([Atype], "GPP","CBB") THEN  -1*[Amnt] +1
ELSE [Amnt] ENDIF

4 REPLIES 4
Felipe_Ribeir0
16 - Nebula

Hi @geeklarokcmie ,

 

If i undertood well, you need to use this formula:

 

IF [Atype] in ('GPP','CBB') then [Amnt]
ELSE -1*[Amnt] ENDIF

 

Felipe_Ribeir0_0-1663610490485.png

 

If the provided answer helped you to solve the problem/was correct, please accept it as a solution :)

 

Thanks.

geeklarokcmie
8 - Asteroid

@Felipe_Ribeir0  Appreciate the response. Also, what would be forumla based on the below requirement:

 

The net ‘Amnt’  where all Atypes with exception of ‘CBB’ are additions. ((If CBB is negative number then everything should be positive number)

 

 

Felipe_Ribeir0
16 - Nebula

Hi @geeklarokcmie 

 

Adapting the first formula, it would be:

 

IF [Atype] in ('CBB') then -1*[Amnt]
ELSE [Amnt] ENDIF

 

If the provided answer helped you to solve the problem/was correct, please accept it as a solution :)

 

Thanks.

geeklarokcmie
8 - Asteroid

@Felipe_Ribeir0 When I used the forumla it is only providing with negative values - I need both positive and negative values to be the result

Labels
Top Solution Authors