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

Null Error while applying Union

aashutosh
5 - Atom

Hello All,

 

I have 2 tables  one field is unique and 2 have different values. Now I need to merge them hence using union, while it generating the output , one table is giving Null value however value is there when looking at the input table.

 

Example below

 

Input

Table 1

Book  PV_Jam

ABS    10

ASN   10

ASM   15

 

Table 2

Book  PV_KAM

ABS    18

ASN   10

ASM   12

 

Output

 

 

Table 2

Book  PV_JAM  PV_KAM

ABS    10            Null

ASN   10             Null

ASM   12            Null

 

thanks for help !

5 REPLIES 5
DataNath
17 - Castor
17 - Castor

Hey @aashutosh, if you want to merge the two tables, are you not meaning to Join them, rather than Union? A union is used to stack data on top of each other, whereas a Join will bring the two datasets side-by-side based on your condition (here, the unique 'Book' field):

 

DataNath_0-1661260570205.png

 

If you do want the data on top of each other, you can Union them. You'll just need to Auto Config by Position (or Manually Configure Fields) so that you can force them to stack, as Alteryx by default will place fields with matching names on top of each other, but yours aren't identical. If you bruteforce them on top of one another with position/manual configuration, the field will keep the name of the dataset that goes on top (which you can decide in the bottom left of the Union configuration - 'Set a Specific Output Order').

aashutosh
5 - Atom

Thanks ! 

I am building my first workflow (and not from coding background), this is helpful !

 

However, I am getting below ; how do I get rid off Right_Book

Book  PV_JAM   Right_Book   PV_KAM

 

MilindG
12 - Quasar

You can use the select tool to get rid of any column you do not want :)

DataNath
17 - Castor
17 - Castor

No problem at all @aashutosh - glad to see you getting into Alteryx!

 

If you look at my screenshot above, you'll see that all of the fields are listed in the bottom of the Join tool configuration. This is all of the fields that will come out of the join once you run your workflow and you can edit these in the exact same way you use a Select tool. You can untick fields so they're not present in the output and you can also change the data type, size and rename said fields. In the answer I provided above, you'll see that I just unticked the 'Right_Book' field so that it doesn't come out in the input. When you're using the join tool, there'll always be duplicate field(s) as they're the unique key that you conduct the join on - by default, the second dataset will always be renamed to Right_FieldName. One easy way to remove these duplicate fields is to use the following dropdown:

 

DataNath_0-1661261380499.png

 

And the 'Right_Book' field is automatically taken care of:

DataNath_1-1661261405301.png

 

Basically, the section highlighted in red acts the same as a Select tool, so you don't need to use Join > Select.

 

DataNath_0-1661261865614.png

aashutosh
5 - Atom

Right, but above in the example from DataNath didn't used it still got the desired results. Just wanted to understand that.. 

 

Thanks for your reply !

Labels
Top Solution Authors