 What's going on everybody? Welcome back to another video. Today we're looking at joins in Tableau. Now before we get into the tutorial I want to give a huge shout out to today's sponsor and that is Udemy. They are having a massive Black Friday sale so everything is about 85% off. So if you've been looking at a course now is the time to buy it. If you are looking at learning and taking an actual full Tableau course there are fantastic ones on Udemy that I have taken myself. So be sure to go and check out Udemy while they're having this huge sale. I will include a link in the description if you want to check them out. Now let's get into the tutorial. All right let's get started and first we're going to start off in Excel. I'm going to kind of walk you through the data that we're working with and then we're going to put it into Tableau and I'm going to show you how to do all those joins in Tableau. So the first table that we have is this demographics table. We have employee ID, name of employee, employee age and employee gender. Now look right here because this will be important going forward in the demographics table. We have 10 individuals and they each have an employee ID. Now when we go to the job title we have our employee ID, employee name and the job title but this one is missing, Ryan Howard, is missing his employee ID and then the very last one there are only seven employee IDs and no names and so we're going to use all of that and I'm going to show you how to actually do the joins in Tableau. Tableau does a really fantastic job of visualizing it for you so it takes a lot of the guess work out. I am going to include a link to my joins video in SQL because these two are very closely connected and if you understand how the joins work in SQL you'll understand how the joins work in Tableau. It's almost the exact same thing. So with that being said let's jump over to Tableau. So I'm going to pull this up and go right over here and now we have where we can connect to our data and so we're going to click Microsoft Excel. I'm going to scroll down here to Tableau joins file. I'm going to open this up and I have it open so I can't use it. So let me get rid of that and let's open it again. Perfect. So now what we're going to do and I'm going to show you how to actually open up the joins in a second but what you need to understand is when you first come here Tableau doesn't automatically allow you to to use the joins. They use something called relationships and there are joins on the back end but they call it relationships because they are inferring all of these things. They're trying to go in and make that inference for you so it takes a lot of the work off of you and most of the time that works and you know you just plug these two things in here like a demographics and the job title and it is going to you know help you build those what they call relationships and you can click on this and learn how the relationships differ from joins. Again there's not a huge difference but it's not as customizable and you can't as easily do left joins or full joins or all these things that we're about to look at. So I'm going to take this one off and what we're going to do to actually be able to look at the joins and choose what joins we want to use is we're going to do this drop-down we're going to click open and so now we are in a place where we can actually create the joins and again it's just much more customizable and so back when I was using Tableau regularly I would use the relationships when it was pretty simple and straightforward because almost they almost always got it right but you know the joins it just makes more sense in the way it visualizes it for me so most of the time I'd be using the joins. So let's pull over this job title right here and it's going to make this connection. Now before if you remember just about you know 30 seconds ago when it connected them it was just a line and so it gave us this option down here to kind of edit the relationship but now it's giving us this visualization and so let's click on it really quick and what is going to come up is the different types of joins that you can do you can do an inner join a left join a right join and a full outer join and then you can actually choose the different data sources and how you're connecting them. So again I'm going to walk through a little bit of this but I think the sequel video that I did on this shows it so well I would just highly recommend using that and I recommend learning sequel too so you know two birds one stone so I'm going to get into each of the joins how they work what data is going to be displayed and these visualizations are really going to be helpful and I think that it's it's just nice that they have it because it's a little reminder okay you know this is what this join is or this is what that join is so super super simple so right now we have the demographics table and we have the job title table and so what it's doing right now and let's get rid of this what it's doing right now is it's doing an inner join and so it's pulling everything that overlaps if it matches on the employee ID and the employee ID and so right now you only see one through nine but if you remember in the demographics table we had uh 1000 all the way through 10 so where is that 10th one well the 10th one is not there and that is because in this job title employee ID it only went up to 1009 and then Ryan Howard just didn't have an employee ID in there for whatever reason so that data is going to be missing now when you are using actual data sets very large data sets which we will use in the next video when we walk through an entire project when you use large data sets this can be the difference between clean data and very wrong data and visualizing it correctly and showing completely wrong numbers and so you really need to be sure you understand how your data works together when you're doing these joins so how can we fix this how can we make it to where we can see all of the data well right now we're only making it to where if the employee ID is equal to the employee ID so we only are going to see through 1009 and through 1009 we're never going to see Ryan so there are two different types of joins that we could do to make it see it and then there's something else that we can join on to where we can see that data the first one that we can look at is the right join and what this does is it's going to take everything that is the same but also everything from this job title table regardless of if it has a match in the demographics table so it's pretty you know this visualization does it all it's going to show everything in the right table regardless and it's only going to show things from this table if there's a match so let's try this one and we should see Ryan Howard in the job title table so let's click on it and if we scroll down there's going to be no no no no until we get to over here where we now have the data that we had in that actual table but again this wasn't a match and so we weren't able to see that data so this gives us a way to where we can see all of it all everything from that right table this job title table and now we're going to click on the full outer now the full outer is going to take everything from both regardless of if there is a match at all and so right here you're going to see Ryan Howard and Ryan Howard now why are there two different rows for it well because any demographics table there was an employee ID so we're seeing the employee ID Ryan Howard his age and his gender and over here there was no match right but in the job title table again this one didn't have an employee ID and so we are going to be able to see this data but over here it has no match and so that's why it's showing us two different rows it's because there was no connection there was no match there that's what a full outer join is going to do now just for the purposes of seeing what this one does as well we have the left hand table and now we are able to see the 110 or 10010 that we didn't see before and it's putting in nulls over here because there's no match so that's that is what we have so far now like I said just a second ago there is a way that we can do this without using the employee IDs we're allowed to use a different join clause now there is the name of the employee in both of them this one is called name of employee and in the job title it's called employee name they don't have to have the same column name in order to join it you can do whatever you want so I'm going to get rid of this one and now we are only tying it on the employee name and let's do an inner join and it should be basically everything except the only piece of data that wasn't filled in which is that 10010 over on the job title table and so this way was a slightly different maybe less thought of way because normally you do it if there's an ID you go on the IDs but because we had a lack of data for in one of the tables in the job title table we decided to use a different column to join on and now we're able to look at all the data together so super quickly that is an inner join a left join a right join in a full outer join and it's pretty easily visualized here and you're able to change what you're joining on right here but you're also you can do multiple so if we want to do the employee ID and the employee ID you can do that as well and you can keep going as many as you'd like and right here or you can change some of these things I don't there aren't a lot of use cases for this but you know you can absolutely do this and mess around with this as seen I'm not going to go through it in the tutorial because again 95 plus percent of the joins you're doing you're going to want to do it to where this equals this and if you want to get into where it doesn't equal or all these other things which is more complicated I think it's much better to learn that in sequel that's my personal preference and so again all in the sequel tutorial if you want to check that one out so you're able to join on multiple things now let's get rid of that one because we can actually bring in this salary one as well and what you'll see right down here is that we have our employee ID and this is all coming from the demographics so employee ID name employer employee age employee gender then right over here we have the job title table so employee ID job title employee name job title and then right over here was or is our salary table and so we have employee ID salary and employee salary so again this is a way that you can put all of this data into one place and just a second we'll go into the worksheet right down here I'm going to show you kind of how it looks because it looks a little bit different than previous tutorials and so I want to show you how that actually all works together but again you can create these joins as well and do the exact same thing that we just looked at and customize the joins customize what you're what you're joining on and then you have your finished product and so right now we have our demographics plus tableau joins file and we can rename that if we want I'm going to call this demographics plus joins demo and click enter and so now that is saved so now let's go down to the go to worksheet we're going to click on that and so up here on our left side this may look a little bit different than it normally does because it's broken out on the measure names and the measure values it's broken out by the tables that they were joined on so we can pull in the employee gender now and we can pull in the employee name now and we can pull in the employee ID again if we want to from the job title and we can pull in the employee ID from the salary table we could do that if we wanted to it makes no sense for actually creating any visualizations but you know you can do that and so you probably you wouldn't be able to do that if you hadn't joined these together and so down here in the measure values the values that we have are from the demographics table and the salary table all of the all of the stuff from the employee title none of those things were values and so we can't use there are going to be no values down here and so really quick let's take the name of the employee let's take their salary sure why not let's order that let's take the employee salary we'll do color and let's expand this out a little bit maybe one more time oops just like that and there you go so that is how you do joins in Tableau and I think Tableau does a really fantastic job of making it pretty simple they have the different types of joins when you click on that that join button and it shows you the inner and the left and the right and the full outer and they make it pretty simple and it's just really useful to be able to see that while you're creating it and see the output below like we just did a second ago it just makes it so simple to create those joins and then just keep going because you already know what your output is going to be and you can kind of mess around with it and make sure you're getting the data that you need in the very next video we're going to be doing an entire project in Tableau we're going to be using a lot more data and it's going to be a complete project that you can add to your portfolio and it's going to be a really good time so I hope that you join me for that one I appreciate your time I hope that this was helpful thank you guys so much for watching I really appreciate it if you like this video be sure to like and subscribe below and I'll see you in the next video