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:
Name | Main Asset | Value |
A | House | 500 |
B | House | 100 |
Left Join (2 cases, one with data one without data):
With Data:
Name | Secondary Asset | Value |
A | Motorbike | 50 |
B | Motorbike | 10 |
Without Data:
No Data.
Result (it is the sum of both asset):
With data:
Name | Value |
A | 550 |
B | 110 |
Without data:
Name | Value |
A | 500 |
B | 100 |
Solved! Go to Solution.
Hi @koulos574
Here is a workflow for the task. Getting output same as your expected output.
Workflow:
Hope this helps 🙂
If this post helps you please mark it as solution. And give a like if you dont mind 😀👍
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.
Thank you both it works like a charm!