Start Free Trial

Alteryx Designer Desktop Discussions

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

Add a value to a new column based on values from two columns

Fescobar
8 - Asteroid

Hello Fellow Builders,

 

I hope that you are all doing well.

 

I need to add a value on a new column (State) based on the values from columns  site_name and site_state.

 

For example if the value of Southern California on site_name and the value of CA on site_state  are true on a row, then the value of the new column State should be SCA.

 

The formula I created is:

IF [site_name] = "SOUTHERN CALIFORNIA" and [site_state] = "CA" then [site_state] = "SCA"
ELSEif [site_name] = "NORTHERN CALIFORNIA" and [site_state] = "CA" then [site_state] = "NCA"
Else [site_state]
ENDif

 

What I'm seeing is the values on site_name are changing to the values on column site_state and the values for SOUTHERN CALIFORNIA and NORTHERN CALIFORNIA changed to 0 on the site_name column.  I would have expected for the values of SOUTHERN CALIFORNIA on column to site_name and values of CA on column site_state to add the value of NCA on column State.

 

Thank you in advance for the help on this.

2 REPLIES 2
ChrisTX
16 - Nebula
16 - Nebula

You select the field name, or create a new field, at the top of each Formula section

 

Try this formula

 

IF [site_name] = "SOUTHERN CALIFORNIA" and [site_state] = "CA" then "SCA"
ELSEif [site_name] = "NORTHERN CALIFORNIA" and [site_state] = "CA" then "NCA"
Else [site_state]
ENDif

 

Chris

Fescobar
8 - Asteroid

.@ChrisTX 

This worked like a charm.  Thank you!!

Labels
Top Solution Authors