Alteryx Designer Desktop Discussions

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

Check if a variable is Between two other variables

Tram
6 - Meteoroid

Hi,

 

I have two data sources and I would like to create a column that says "true" when one variable is between two other variables from another data source

Source 1:

 

NameVal
A1
A2
A3
A4
A5
A6
A7
A8
A9
A10
B1
B2
B3
B4


  Source 2:

NameStartEnd
A35
A89
B12

 

I would like the end result to look like

 

NameValIn-between
A1false
A2false
A3true
A4true
A5true
A6false
A7false
A8true
A9true
A10true
B1true
B2true
B3false
B4false

 

I'm struggling to figure out to get achieve this. I'm pretty sure I would need to write the formula Val >= Start && Val <= End at some point, but I'm not sure how to put everything together. Is it possible?

 

Thanks

3 REPLIES 3
jdunkerley79
ACE Emeritus
ACE Emeritus

Looking at your sample data you can have multiple ranges for each name. 

 

I'd suggest:

 

2018-11-20_22-01-41.png

 

- Join the two tables on name (this will create duplicates from first table)

- Create a filter where val between start and end

- Use a unique to remove duplicated from the true output

- Join again to the original table A

- Use a formula tool on L and J outputs to make the T/F column

- Union results

 

Sample attached

ivoller
12 - Quasar

Similar to @jdunkerley79, joined first then summarized, sorted and removed duplicate (false) values

 

2018-11-20_17-07-12.png

Tram
6 - Meteoroid

Thanks @jdunkerley79 and @ivoller!

Labels