Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Left join has sometimes not data

koulos574
5 - Atom

Hello everyone, 

 

Request:

 

I need to make a join but sometimes my left join has no data. 
My goal is to always keep the right join and if the left join has data, we join them (on name in the example) if not we keep the right join. Is this feasible? 

 

See below for an example (Rows can vary, they're not fixed but columns are always the same):

 

Example:

 

Right Join:

 

NameMain AssetValue
AHouse500
BHouse100

 

Left Join (2 cases, one with data one without data):

 

With Data:

 

NameSecondary AssetValue
AMotorbike50
BMotorbike10

 

Without Data:

 

No Data.

 

Result (it is the sum of both asset):

 

With data: 

 

NameValue
A550
B110

 

Without data:

 

NameValue
A500
B100
4 REPLIES 4
atcodedog05
22 - Nova
22 - Nova

Hi @koulos574 

 

Here is a workflow for the task. Getting output same as your expected output.

Workflow:

atcodedog05_0-1605545645456.png

 

Hope this helps 🙂


If this post helps you please mark it as solution. And give a like if you dont mind 😀👍

echuong1
Alteryx Alumni (Retired)

You'd want to do essentially a traditional "left join." The join tool will give you a "left outer join" out of the J output. To get everything from the left regardless of matching, add a union tool after to combine the L and J outputs.

 

You can also just do a union to stack both ontop of each other, and then aggregate by group.

 

echuong1_0-1605545711606.png

 

koulos574
5 - Atom

Thank you both it works like a charm!

atcodedog05
22 - Nova
22 - Nova

Happy to help 🙂 @koulos574 

 

Cheers and Happy Analyzing 😀

Labels