Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:05,240 --> 00:00:05,960
Can this lesson.
2
00:00:05,960 --> 00:00:09,790
We're going to continue to transform our data using the query editor.
3
00:00:09,800 --> 00:00:11,570
So I'm going to move across a little bit.
4
00:00:11,570 --> 00:00:13,970
And you'll remember we got to the gender.
5
00:00:13,970 --> 00:00:16,940
We've got our list of applied steps that we've got at the moment.
6
00:00:17,210 --> 00:00:20,770
If you look at our higher date, you'll see that that automatically converted.
7
00:00:20,780 --> 00:00:24,140
But just remember, if you need to convert it manually, can click on this.
8
00:00:24,140 --> 00:00:26,710
Just say using the call and you can change it.
9
00:00:26,720 --> 00:00:32,870
Please note, though, that if it has changed to a date and it's incorrect, is that you need to change
10
00:00:32,870 --> 00:00:36,560
it back to text again before you can do a transformation.
11
00:00:36,560 --> 00:00:40,030
Otherwise you're going to be trying to transform data that's already been transformed.
12
00:00:40,040 --> 00:00:41,270
So just be aware of that.
13
00:00:41,270 --> 00:00:44,930
If it's if it's not correct, just transform it back to to text.
14
00:00:45,590 --> 00:00:50,420
Now what you'll see is that as we go along here, we've got some other data that we've got celery flag,
15
00:00:50,480 --> 00:00:55,700
vacation hours and so on, and then a whole bunch of columns that we probably don't need.
16
00:00:56,150 --> 00:01:00,710
Now, one of the things that you can do is you've got this great option called Choose columns up on
17
00:01:00,710 --> 00:01:01,400
your ribbon.
18
00:01:01,550 --> 00:01:06,020
So if you go up to the top here, say choose columns, this will allow you to actually see a list of
19
00:01:06,020 --> 00:01:06,830
all the columns.
20
00:01:06,860 --> 00:01:07,670
I really like this.
21
00:01:07,670 --> 00:01:10,220
It makes it so much easier to actually come into this.
22
00:01:10,310 --> 00:01:15,590
So what I might do is actually everything that is off to sick leave hours is I'm actually going to remove
23
00:01:15,590 --> 00:01:18,350
all of those columns from my actual query.
24
00:01:18,470 --> 00:01:19,520
So there we go.
25
00:01:19,520 --> 00:01:24,650
I've removed all those columns and we just now go up to the sick leave hours and we've now got the data
26
00:01:24,650 --> 00:01:25,850
that we're working with.
27
00:01:26,720 --> 00:01:30,410
So at this point now, we've done some transformations, we've made some changes.
28
00:01:30,410 --> 00:01:36,140
I just do want to highlight that if we go to an option called the Advanced Editor, let me click on
29
00:01:36,140 --> 00:01:36,590
this.
30
00:01:36,590 --> 00:01:38,600
You're going to see that this produces script.
31
00:01:38,750 --> 00:01:44,240
So everything that we're doing in the graphical interface at the moment is actually just creating scripts
32
00:01:44,240 --> 00:01:45,020
in the background.
33
00:01:45,020 --> 00:01:47,840
So it makes query editor extremely efficient.
34
00:01:47,930 --> 00:01:53,990
So when query editor is actually working, what it does is it actually just runs a script and it doesn't
35
00:01:53,990 --> 00:01:56,840
actually save any of the data that has been transformed.
36
00:01:56,870 --> 00:02:02,390
It basically runs the script, transforms the data as it's working, and it actually only then imports
37
00:02:02,390 --> 00:02:05,600
the data that has been transformed and changed right at the end.
38
00:02:05,750 --> 00:02:10,910
So this can make it incredibly sort of efficient when you're trying to bring data into power by especially
39
00:02:10,910 --> 00:02:15,440
if you use filters and you're removing data that you don't need, and then you only bring in the data
40
00:02:15,440 --> 00:02:16,520
that you actually do need.
41
00:02:16,910 --> 00:02:21,060
The next part is if you look at the script itself, you can see it's not too difficult to actually follow.
42
00:02:21,080 --> 00:02:26,390
You can see that the commands that have been used so often, people may study the script itself and
43
00:02:26,390 --> 00:02:28,370
go in and actually make changes.
44
00:02:28,370 --> 00:02:32,780
Please note, though, that it does have to be exactly the right case sensitivity.
45
00:02:32,780 --> 00:02:36,530
So you've got to follow exactly the rules that are there at the moment.
46
00:02:36,710 --> 00:02:41,390
Otherwise you'll find that actually using the graphical interface just works perfectly and you can pretty
47
00:02:41,390 --> 00:02:42,830
much do everything you need to.
48
00:02:42,980 --> 00:02:46,730
Now, when you get to a point where you've done your list of transformations and you're happy with the
49
00:02:46,730 --> 00:02:52,310
results and click on Done and you'll see that there's an option on the top here called Close and Apply.
50
00:02:52,430 --> 00:02:54,140
So I'm going to choose close and apply it.
51
00:02:54,140 --> 00:02:58,700
And what that's going to do is it's going to close the query editor and it's going to now apply this.
52
00:02:58,700 --> 00:03:03,560
And you're going to see now that this data is going to be loaded into my Power BI desktop.
53
00:03:03,770 --> 00:03:05,810
So we've got now our Power BI desktop.
54
00:03:05,810 --> 00:03:09,020
If I go across to my fields, you'll see that I've got my employee master.
55
00:03:09,020 --> 00:03:10,790
Remember I change the table name.
56
00:03:10,790 --> 00:03:15,620
Also, I've only got the fields that are selected and you can see that the higher date and the birth
57
00:03:15,620 --> 00:03:18,800
date are both correctly being seen as data fields.
58
00:03:18,800 --> 00:03:23,090
And also I've got some numeric fields here that are correct as well.
59
00:03:23,090 --> 00:03:29,570
So if I wanted to now create a report out of this, let's say I wanted a matrix and I wanted to see
60
00:03:29,570 --> 00:03:35,270
my job position, how many people I've got by different gender, then I could take my job position,
61
00:03:35,270 --> 00:03:40,670
drop that into my rows, I could take my employee ID and we'll do a count on that.
62
00:03:40,670 --> 00:03:44,120
And we could take our gender and we could drop that into a columns.
63
00:03:44,210 --> 00:03:50,660
And you'll notice that I get female male and it's now doing a count of all the options that we've got
64
00:03:50,660 --> 00:03:51,920
of the number of people.
65
00:03:51,920 --> 00:03:56,510
So just in terms of the values, what we would do is we would say that we want this to be counted.
66
00:03:56,720 --> 00:03:57,710
And there we go.
67
00:03:57,740 --> 00:04:02,810
I've got 84 females, 206 miles, 290 rows in total.
68
00:04:03,710 --> 00:04:09,860
Okay, so we've created now a table and we're going to take this to our human resource department.
69
00:04:09,860 --> 00:04:11,120
And they say, that's fantastic.
70
00:04:11,120 --> 00:04:15,080
But one of the things that they really need to know is what is the age of the person?
71
00:04:15,230 --> 00:04:19,910
And we can see here that we've actually got a birth date, but we don't actually have the age of the
72
00:04:19,910 --> 00:04:20,630
person.
73
00:04:20,930 --> 00:04:26,030
So let's say we're going to go back into now our query editor and we're going to transform this so that
74
00:04:26,030 --> 00:04:28,220
we can actually get that as a new field.
75
00:04:28,280 --> 00:04:31,910
So what we're going to do is we're going to go up to our ribbon and you'll see that there's an option
76
00:04:31,910 --> 00:04:36,530
called transform data, and we're going to select that, and that's going to open our query editor.
77
00:04:37,220 --> 00:04:41,440
So you can see our query editor is now opened and we're back into exactly where we were.
78
00:04:41,450 --> 00:04:44,490
We've still got a list of applied steps that we've created so far.
79
00:04:44,510 --> 00:04:48,020
But what we want to do now is we actually want to create a new field.
80
00:04:48,380 --> 00:04:52,850
So we're going to go across to our birth date and we're going to use that as the basis for calculating
81
00:04:52,850 --> 00:04:54,560
what is the age of a person.
82
00:04:55,190 --> 00:05:00,680
Now at the top, you'll see that with the menu options, you get a number of different transformations
83
00:05:00,680 --> 00:05:02,870
that you can do to an existing field.
84
00:05:03,140 --> 00:05:08,160
Also, what you get is the ability to be able to add new columns based on existing fields.
85
00:05:08,180 --> 00:05:12,320
Now, this is what I'm going to do, is I'm actually going to use the birth date to do a calculation
86
00:05:12,320 --> 00:05:13,040
for the egg.
87
00:05:13,520 --> 00:05:18,530
So I'm going to keep it on add column and we're going to go across to the date and you'll see that there's
88
00:05:18,530 --> 00:05:20,870
a number of different options that I could do here.
89
00:05:20,900 --> 00:05:25,460
For example, if I wanted to know what year the person was born in, I could actually go to the date,
90
00:05:25,460 --> 00:05:28,290
go to year and just choose the year itself.
91
00:05:28,310 --> 00:05:34,220
And what you'll see is now that the year will be taken out of the birth date, and we now have just
92
00:05:34,220 --> 00:05:35,720
that as a piece of information.
93
00:05:35,750 --> 00:05:39,230
So I could just say here, call this, say our birth.
94
00:05:40,470 --> 00:05:41,040
Yeah.
95
00:05:42,150 --> 00:05:43,770
And there we have a new field.
96
00:05:44,520 --> 00:05:45,360
But let's go back.
97
00:05:45,360 --> 00:05:49,050
Let's look at the tasks that we're trying to do, which is actually to calculate the eight.
98
00:05:49,230 --> 00:05:52,890
So I'm going to select the birth date again, and we're going to go back to add column.
99
00:05:52,890 --> 00:05:57,960
Just make sure add column is selected, go back to date and you'll see that there's an option called
100
00:05:57,960 --> 00:05:58,320
A.
101
00:05:58,830 --> 00:06:00,030
So we're going to select that.
102
00:06:00,030 --> 00:06:03,330
And you can see now it creates a new column called Age.
103
00:06:03,450 --> 00:06:05,050
We also get a different data type.
104
00:06:05,070 --> 00:06:07,770
You're going to see that this is a duration data type.
105
00:06:07,770 --> 00:06:10,230
So this is telling me that this is the duration.
106
00:06:10,680 --> 00:06:15,390
Now, what it's done is actually not really what I wanted is calculated The number of days that the
107
00:06:15,390 --> 00:06:16,710
person's been alive for.
108
00:06:16,860 --> 00:06:20,970
It's also got you can see some time elements as well, which I don't really need.
109
00:06:21,300 --> 00:06:26,310
So what we do need to do is actually some transformation to this field to actually get it a little bit
110
00:06:26,310 --> 00:06:26,880
better.
111
00:06:27,210 --> 00:06:31,980
So I'm going to select my age field and this time now I'm going to go to my transform options.
112
00:06:32,100 --> 00:06:38,910
And you'll see with the age that now my duration under the date and time column is actually available.
113
00:06:39,270 --> 00:06:44,910
And what I can tell this to do is actually convert this into rather a number of years rather than a
114
00:06:44,910 --> 00:06:45,980
number of days.
115
00:06:45,990 --> 00:06:48,630
So I'm going to say show me the total number of years.
116
00:06:49,260 --> 00:06:49,830
And there we go.
117
00:06:49,830 --> 00:06:51,390
It's done now, conversion again.
118
00:06:51,390 --> 00:06:53,520
And it's showed me the number of years.
119
00:06:53,610 --> 00:06:57,110
But as you can see, this is probably not quite what I want.
120
00:06:57,120 --> 00:06:59,760
This is actually now showing my decimal.
121
00:07:00,150 --> 00:07:05,250
Now, the reality is with somebody's age is they or that age until the day that they actually turn to
122
00:07:05,250 --> 00:07:06,000
the new age.
123
00:07:06,360 --> 00:07:10,890
So one of the transformations I could look at is I could say, take this field.
124
00:07:11,220 --> 00:07:12,600
I could actually use a rounding.
125
00:07:12,600 --> 00:07:17,850
So if I round this down, then it would actually round it down to the actual number of years that there
126
00:07:17,850 --> 00:07:18,700
have been a lot.
127
00:07:18,750 --> 00:07:20,490
So I'm going to say run down.
128
00:07:20,910 --> 00:07:26,400
And you can see now that this actually does give me the age as a rounded down option.
129
00:07:26,610 --> 00:07:28,470
So as you can see, there's a couple of steps involved.
130
00:07:28,470 --> 00:07:32,940
But I wanted to show you this just as an example of one of the things that you can do with Query Editor.
131
00:07:33,090 --> 00:07:37,560
You're going to find that it's a really powerful piece of software to help you with the transformation
132
00:07:37,560 --> 00:07:38,370
of your data.
133
00:07:38,370 --> 00:07:40,980
And there's a lot of different things that you can do.
134
00:07:41,640 --> 00:07:46,860
If we go back now, if we close and apply this and let's bring that back into our power.
135
00:07:46,890 --> 00:07:55,050
BI you'll now see that we do have a new field called age and we can now look at say, Oh, let's just
136
00:07:55,050 --> 00:07:56,040
get a table.
137
00:07:56,130 --> 00:08:01,410
Let's go to our job positions again and let's say we wanted to know what is the average age for each
138
00:08:01,410 --> 00:08:02,610
of the job positions.
139
00:08:02,700 --> 00:08:04,590
So let's just drop that in there.
140
00:08:05,070 --> 00:08:06,270
Let's get our age.
141
00:08:07,920 --> 00:08:08,940
Drop that in there.
142
00:08:09,510 --> 00:08:14,520
Now, you can see by default it summed up the age, but in this case we would want to average age.
143
00:08:14,850 --> 00:08:16,890
You can now see for that job position.
144
00:08:17,100 --> 00:08:18,300
You've got your average age.
145
00:08:18,570 --> 00:08:21,420
If you wanted to I'm just going to delete this, make this a bit wider.
146
00:08:22,190 --> 00:08:28,610
We could add a couple more ages as well, and you could actually then say, what is the maximum age,
147
00:08:28,610 --> 00:08:29,680
i.e. the highest age?
148
00:08:29,690 --> 00:08:31,070
What is the minimum age?
149
00:08:33,190 --> 00:08:35,890
So let's say, for example, we dropped the age again.
150
00:08:36,780 --> 00:08:40,799
You said in this case you wanted to know what is the maximum is the max age.
151
00:08:42,010 --> 00:08:43,090
Take the edge again.
152
00:08:44,270 --> 00:08:45,470
Take the minimum age.
153
00:08:45,500 --> 00:08:46,580
See the mean age.
154
00:08:47,120 --> 00:08:51,830
Also, you could actually see how many people are in each of the positions at our employee ID.
155
00:08:52,040 --> 00:08:53,030
Try that again.
156
00:08:53,830 --> 00:08:55,600
Have we got to count on that?
157
00:08:56,730 --> 00:08:58,650
And you can see how many people.
158
00:08:58,650 --> 00:09:03,120
So as you can see using the query editor, we've created a new field that we didn't have before, but
159
00:09:03,120 --> 00:09:07,920
it's allowed us to do some powerful data analysis and to get some new insights into our data.
160
00:09:08,340 --> 00:09:09,680
We're going to conclude the lesson there.
161
00:09:09,690 --> 00:09:10,770
I will see you in the next one.
16173
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.