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.

HOW TO ADD NUMBERS BASED ON CONDITION

dunkindonut7777
8 - Asteroid

Hey guys, I would like to ask if how can I add numbers in a row based on a given code. I have a data here:

 

CodeAmount
74584

95007.56

43575-400
43554890

 

then I want to add these numbers to each code:

74584 = 700

43575= -50

43554= 10

 

Expected Amount:

 

CodeExpected Amount
7458495707.56
43575-450
43554

900

Can you help me with this one pls?

3 REPLIES 3
AngelosPachis
16 - Nebula

Hey @dunkindonut7777 ,

 

Maybe something like this works in your occasion

 

AngelosPachis_0-1634144356745.png

 

atcodedog05
22 - Nova
22 - Nova

Hi @dunkindonut7777 

 

Just extending on @AngelosPachis solution and doing a full left join so that data is not missed out. If the code is not present in the list then the add is 0.

 

Workflow:

atcodedog05_0-1634144846612.png

 

Hope this helps : )

HomesickSurfer
12 - Quasar

Hi @dunkindonut7777 

 

Keep it simple and efficient:

Use Select Tool to modify the [Amount] field to Type: FixedDecimal, Size: 19.2, then using a Formula Tool, modify the [Amount] field values using the following expression:

 

If you have additional codes, modify accordingly.

 

IF [Code]=74584 THEN [Amount]+700 ELSEIF [Code]=43575 THEN [Amount]-50 ELSEIF [Code]=43554 THEN [Amount]+10 ELSE [Amount] ENDIF

 

Labels
Top Solution Authors