Start Free Trial

Alteryx Designer Desktop Discussions

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

match based on numbers

JokeFun
8 - Asteroid

I have two reports that need to be joined/matched with each other. There's no common fields except for the number values, which are also not matching one by one. Like below Example shows. I am seeking your great ideas on this! Thanks in advance.

Data 1

Name1Value1
A100
B150
C150
D201
E51
F30
G101

 

Data 2

Name 2Value 2
rabbit201
tiger300
mouse151
mouse131

The expected result. (Let's just assume the numbers are quite nice that there won't be cases like rabbit 300 and tiger 300, or A+B=200 and A+C=200, so that each animal can match to one or multiple letters based on the numbers.)

Name1Value1Name2Value2
A100mouse151
B150tiger300
C150tiger300
D201rabbit201
E51mouse151
F30mouse131
G101mouse131
8 REPLIES 8
Sebastiaandb
12 - Quasar

@JokeFun 

 

This would be the result of a normal join. Could you be more precise of what you want to achieve? There's no way you can join E/50 with mouse/150, then it would be more append fields logic. Just let us know, i'm sure we can help you out :-).

Sebastiaandb_0-1635315149938.png

 

Greetings,

 

Seb

 

JokeFun
8 - Asteroid

Sorry, one error on value 2 in the third table for tigers. just updated. 

Basically, I need to match the animals with names in table 1 based on the numbers. A simple join wont work, I believe.

Sebastiaandb
12 - Quasar

@JokeFun 

 

Data 1

Name1Value1
A100
B150
C150
D200
E50

 

Data 2

Name 2Value 2
rabbit200
tiger300
mouse150

 

In your example. A value of  Rabbit 200 (in data 2) can normally only be joined to D 200 (Data 1). A value for tiger wouldn't have a match and mouse would only match with C 150 and B 150 as mouse stands for 150. 

 

So a normal join would result in:

 

Name1Name2Value
BMouse150
CMouse150
DRabbit200

 

From trying to follow your logic, you're searching for something that says "if a value of Data 1 is smaller than up to, then it falls in the category of animal x"? For me it's still not clear to what you want to achieve. I can't follow the logic of your example, sorry.

 

Greeting, 

 

Seb

JokeFun
8 - Asteroid

Sorry, bad numbers. Just updated with more sample data. So actually table 2 is kind of summary of table 1, but not exactly either. Like mouse category, there're two number 141 and 131. The purpose is to find the Name2 for each Name1.

Nanoq
8 - Asteroid

@JokeFun Can you explain a bit more on the logic that would match up your values? specifically i have a hard time seeing how tiger is B and C? 

JokeFun
8 - Asteroid

@Nanoq It is simply because B+C=300, while tiger is 300. Just based on the numbers.

 

Basically, I am thinking of a solution like this by building a macro:

take A first, check if the value exist in table 2, if it matches, then get name2. 

if not, then take sum(A+B) and check again if this exist in table 2,

then A+C,

A+D,

....

and then 

A+B+C

A+B+D

...

and

A+C+D

A+C+E

...

and then

B,

B+C

B+D

..

B+C+D

B+C+E

...

B+D+E,

so on so forth

Nanoq
8 - Asteroid

@JokeFun by that logic, (A+E) is also 300, and tiger should be A and E too?
how should it be handeled if a single value 1 can be used in multiple value2's?

 

JokeFun
8 - Asteroid

You are right. I just updated the numbers. Suppose there's no multiple matches.

Labels
Top Solution Authors