Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:05,330 --> 00:00:10,970
In this lesson, I'd like to continue to look at some options that creating relationships allows us
2
00:00:10,970 --> 00:00:11,960
to do so.
3
00:00:11,960 --> 00:00:17,150
We did see in the previous lesson that we were able to use now the fields from the two different tables
4
00:00:17,150 --> 00:00:19,310
and we could use those in our visualization.
5
00:00:19,310 --> 00:00:23,860
So we were using our job grade and our cost, for example, and obviously it worked.
6
00:00:23,870 --> 00:00:28,290
I just want to show you, though, quickly that if you do not have a relationship, what actually happens?
7
00:00:28,290 --> 00:00:29,720
So let's go back to our model.
8
00:00:29,960 --> 00:00:31,970
Let's just delete that relationship.
9
00:00:31,970 --> 00:00:34,150
So there's no relationship between the two.
10
00:00:34,160 --> 00:00:38,420
Now, if you go back to your visualizations, you'll see that you get this where it just basically gives
11
00:00:38,420 --> 00:00:43,700
you the total cost for each of your department when this visualization is also doing the same.
12
00:00:44,120 --> 00:00:48,050
If you get that as a result, you then know there's a problem between your relationship.
13
00:00:48,500 --> 00:00:49,640
Let's just recreate that.
14
00:00:49,640 --> 00:00:53,540
I'm just going to use the drag and drop method, and if we go back now, we should see that that is
15
00:00:53,540 --> 00:00:54,350
corrected.
16
00:00:54,560 --> 00:00:57,590
Okay, So that's just something to look out for with your relationships.
17
00:00:57,800 --> 00:01:03,770
Let's go back into our data and let's say, for example, we were looking at this master table and we
18
00:01:03,770 --> 00:01:09,380
go to each of our employee names and what we wanted to do was actually create a new column for each
19
00:01:09,380 --> 00:01:10,340
of our employees.
20
00:01:10,340 --> 00:01:14,930
And what we wanted to know for each of our employees was what were their total training costs?
21
00:01:14,930 --> 00:01:19,190
And then also we wanted to know how many training courses have they actually been on.
22
00:01:19,580 --> 00:01:23,270
Now you'll remember that previously create a new column.
23
00:01:23,270 --> 00:01:27,800
We use the new column option, which allowed us to create a calculated column.
24
00:01:28,220 --> 00:01:32,510
Now, one of the really nice things about the equals calculate function that we covered earlier is it
25
00:01:32,510 --> 00:01:37,310
allows us to work between using a relationship so we can go between tables.
26
00:01:37,430 --> 00:01:39,470
So let's have a look at an example of that.
27
00:01:39,620 --> 00:01:41,540
Okay, So let's create our first column.
28
00:01:41,540 --> 00:01:43,400
Let's say we're going to create a new column here.
29
00:01:43,550 --> 00:01:47,540
And again, we got now our different formula bar up there.
30
00:01:47,540 --> 00:01:48,560
So we're going to use.
31
00:01:49,430 --> 00:01:52,670
Training cost is going to be our new field name.
32
00:01:52,670 --> 00:01:53,960
I'm going to say equals.
33
00:01:54,350 --> 00:01:58,160
And in this case, we're going to say calculate, because we want to use calculate, because it can
34
00:01:58,280 --> 00:01:59,900
go between the relationships.
35
00:02:00,020 --> 00:02:01,580
So we want to say calculate.
36
00:02:01,580 --> 00:02:06,710
And what we wanted to do is we wanted to sum up the cost that is in the workshop table.
37
00:02:06,800 --> 00:02:12,470
So we're going to say you're going to sum and you're going to use your parentheses, and in this case
38
00:02:12,470 --> 00:02:14,810
we're going to send it across to the workshops table.
39
00:02:14,960 --> 00:02:17,900
And you'll see there that we have the cost field.
40
00:02:18,140 --> 00:02:19,460
So we're going to select that.
41
00:02:19,550 --> 00:02:24,710
So you can see equals calculate the sum of the cost in the workshops table.
42
00:02:25,010 --> 00:02:27,290
Now, just be careful with the number of parentheses.
43
00:02:27,290 --> 00:02:30,950
You'll see that my first parentheses is closing my expression by some expression.
44
00:02:30,950 --> 00:02:34,760
Then the second parentheses actually closes the equals calculate.
45
00:02:34,880 --> 00:02:38,030
So just make sure you got two closing parentheses here.
46
00:02:39,130 --> 00:02:44,140
Once you're happy with your formula, we can press enter on that and you'll now see that the training
47
00:02:44,140 --> 00:02:46,270
cost is now correctly calculated.
48
00:02:46,270 --> 00:02:52,120
So basically it's gone across the workshop table and it's now calculated the total cost for each of
49
00:02:52,120 --> 00:02:53,170
your employees.
50
00:02:53,980 --> 00:02:56,290
Let's look for another example of this.
51
00:02:56,290 --> 00:03:00,400
Let's say, for example, we wanted to know how many courses the people have been on.
52
00:03:00,730 --> 00:03:04,010
So we're going to create a new column again.
53
00:03:04,030 --> 00:03:09,970
So in this case, let's go to actually use these three parentheses, three ellipses, click on the three
54
00:03:09,970 --> 00:03:11,830
ellipses, choose new column.
55
00:03:12,250 --> 00:03:16,360
And we're going to say now that this is the number of courses.
56
00:03:17,770 --> 00:03:18,820
Again equals.
57
00:03:18,850 --> 00:03:22,720
Remember, it's going to be equals calculate because we want it to go across the relationship.
58
00:03:23,050 --> 00:03:26,020
And in this case, what we're going to do is we're going to use a count expression.
59
00:03:26,020 --> 00:03:31,480
We want it to go and count the number of employee IDs that are in the workshop.
60
00:03:31,660 --> 00:03:32,920
So we're going to say count.
61
00:03:33,250 --> 00:03:37,490
And in this case, again, we're going to send it across to count the number of workshops.
62
00:03:37,510 --> 00:03:42,520
So let's say we want to count the workshops table, the number of employee IDs.
63
00:03:43,580 --> 00:03:44,780
I'm going to accept that.
64
00:03:44,780 --> 00:03:47,480
I'm going to have to parentheses close it.
65
00:03:47,630 --> 00:03:51,860
It's a number of courses equals calculate the count of the employee ideas.
66
00:03:51,880 --> 00:03:53,270
I'm going to press enter on that.
67
00:03:53,330 --> 00:03:58,550
So you can see now that it's going to cross and it's now counted how many courses the people have been
68
00:03:58,550 --> 00:03:58,970
on.
69
00:03:59,360 --> 00:04:04,280
I can also see that, for example, where people haven't been on any courses, it's actually just giving
70
00:04:04,280 --> 00:04:05,660
me blanks for that.
71
00:04:05,690 --> 00:04:06,390
There we go.
72
00:04:06,410 --> 00:04:08,870
This person's obviously been on no courses.
73
00:04:09,740 --> 00:04:09,920
Okay.
74
00:04:09,920 --> 00:04:15,440
So that's a really useful function to be able to use the calculator column and the equals calculate
75
00:04:15,440 --> 00:04:17,899
and to be able to then go across.
76
00:04:18,290 --> 00:04:22,310
Also, what I'm going to look at is let's say we were looking at our workshops table.
77
00:04:23,120 --> 00:04:26,780
And one of the things that you might use quite a bit in Excel is called the VLOOKUP.
78
00:04:26,780 --> 00:04:32,000
So every lookup allows you to go to another table, look up a piece of information and return it to
79
00:04:32,000 --> 00:04:33,250
your existing table.
80
00:04:33,260 --> 00:04:37,760
So something that relationships allow us to do is to be able to do the exact same thing.
81
00:04:38,120 --> 00:04:43,760
So let's say within our workshops now we have the employee ID and so it tells me this is employee ID
82
00:04:43,760 --> 00:04:44,600
number one.
83
00:04:44,720 --> 00:04:48,830
Now if I go back to the master table, I can see that one is Gustavo.
84
00:04:49,460 --> 00:04:52,790
Now what I might want to do is actually return the employee name.
85
00:04:52,790 --> 00:04:58,410
And let's say, for example, his department back into the workshop table.
86
00:04:58,430 --> 00:05:01,790
So we might want to have that information over here.
87
00:05:02,150 --> 00:05:07,120
So again, we're going to create a new column because we want this now to return a result for each row.
88
00:05:07,130 --> 00:05:12,800
So we say new column and we're going to say now we want to know what is the employee name.
89
00:05:13,310 --> 00:05:17,930
Now, please note, remember, you can have this same field name, but in different tables.
90
00:05:18,050 --> 00:05:23,210
So we're going to say employee name in this case equals we're going to use a function called related.
91
00:05:24,100 --> 00:05:29,230
So once you use related, it's basically doing a VLOOKUP, it's going to use the relationship and it's
92
00:05:29,230 --> 00:05:34,230
going to go across to the other table and it's going to look up this employee ID and return the information.
93
00:05:34,240 --> 00:05:35,730
So we're going to say related.
94
00:05:35,740 --> 00:05:40,990
We wanted to go to the master table and we wanted to return the employee name field.
95
00:05:41,260 --> 00:05:44,270
So we just choose master table, employee name.
96
00:05:44,290 --> 00:05:47,380
This one's only got one parentheses that needs to close.
97
00:05:47,920 --> 00:05:50,020
And we're going to select related on that.
98
00:05:50,350 --> 00:05:56,080
And you can see now that we return the employee name and correctly we got Gustavo as the employee number
99
00:05:56,080 --> 00:05:56,620
one.
100
00:05:57,370 --> 00:05:59,650
The other one that we wanted to see was the department.
101
00:05:59,650 --> 00:06:01,750
I'm going to use the same, same thing again.
102
00:06:01,750 --> 00:06:07,600
So again, we're going to create a new column and this one we want to say is going to be our department.
103
00:06:08,660 --> 00:06:10,100
I'm going to say equals.
104
00:06:10,460 --> 00:06:12,770
In this case, again, we're going to use related.
105
00:06:14,150 --> 00:06:16,460
And again, we wanted to go to the master table.
106
00:06:16,460 --> 00:06:22,610
And in this case, we're going to return the department again, just one parentheses to close this.
107
00:06:23,120 --> 00:06:24,500
And we're going to press enter.
108
00:06:24,890 --> 00:06:28,220
And as you can see, there's quite a powerful lookup that we can use.
109
00:06:28,760 --> 00:06:29,490
So there we go.
110
00:06:29,510 --> 00:06:34,310
There's some examples that you can use with your relationships to create calculations and also lookups.
111
00:06:34,430 --> 00:06:35,920
We're going to conclude the lesson there.
112
00:06:35,930 --> 00:06:37,100
I will see you in the next one.
11250
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.