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

Conditional Statement based on Data from Separate Inputs

bfoll
6 - Meteoroid

I have an one CSV with a list of countries and their population (A). I have a second CSV with U.S. states and their populations (B). I'd like to implement a formula that matches states with = or < populations to that country and append that state and state pop information to Tablea A. Here's what I mean:

 

Example:

Table A:

CountryPopulation
Afghanistan2666000
Albania10000

 

Table B:

StatePopulation
Alabama1162900
Arkansas762600
Rhode Island9000

 

and I want my output to look like this:

 

CountryState EquivilentCountry PopState Pop
Afghanistan Alabama2666000 1162900
Afghanistan Arkansas2666000 762600
AfghanistanRhode Island2666000 9000
AlbaniaRhode Island100009000

 

What is the most effecient way to do this in Alteryx?

2 REPLIES 2
RodL
Alteryx Alumni (Retired)

Easiest way is to use an Append Fields tool (which basically gives you a Cartesian join of your two data sets).

Then you just add a Filter tool that filters on the basis of the one population field being =< the other population field.

 

(As a note, in the Append Fields tool, you will need to change the default setting at the bottom of the Configuration so as to "Allow All Appends".)

bfoll
6 - Meteoroid

Thanks! I begun with a union and added a flag for "Country" or "State" - I knew there must have been something closer to what I was looking for. Appreciate it. :)

Labels
Top Solution Authors