Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:05,400 --> 00:00:09,090
Welcome to this section on Microsoft Power BI Query Editor.
2
00:00:09,510 --> 00:00:13,110
So far, every time we've loaded our data, we've just clicked on the load button.
3
00:00:13,110 --> 00:00:16,590
But you may have noticed next to it is a transformed data option.
4
00:00:16,800 --> 00:00:20,940
Now what we've got with Query editor is the ability to be able to transform your data.
5
00:00:21,060 --> 00:00:25,020
You're going to see that this is a really powerful product and we're just going to show you a little
6
00:00:25,020 --> 00:00:27,210
bit of an overview of how it works.
7
00:00:27,300 --> 00:00:30,880
So we come back into Power BI and I've actually created a new Power BI.
8
00:00:30,900 --> 00:00:35,580
We're going to load a new data file into this just to be able to show some of the examples with the
9
00:00:35,610 --> 00:00:37,020
with the query editor.
10
00:00:37,650 --> 00:00:39,640
So this is going to be a CSV file.
11
00:00:39,660 --> 00:00:41,760
So we're going to do things a little differently.
12
00:00:41,770 --> 00:00:43,290
We're going to go to get data.
13
00:00:43,290 --> 00:00:48,420
And if we go down a little bit, you'll see on the most common data sources, we do have text CSV as
14
00:00:48,420 --> 00:00:50,430
an option, so I'm going to select that.
15
00:00:51,220 --> 00:00:55,840
Okay, then I'd like you to navigate to where you've downloaded the course files, and you'll see that
16
00:00:55,840 --> 00:00:58,720
there's a file called employee Data dot CSV.
17
00:00:59,050 --> 00:01:02,470
So please select that file and you're going to click on the open button.
18
00:01:03,560 --> 00:01:07,250
Now you're going to see that things are a little bit different to when we've opened Excel.
19
00:01:07,370 --> 00:01:11,960
It's going to show us a preview of the table because with the CSV or a text file, you can only have
20
00:01:11,960 --> 00:01:13,170
one table of data.
21
00:01:13,190 --> 00:01:14,990
You can't have multiple tables.
22
00:01:15,230 --> 00:01:18,290
So in this case, it shows us straight away a preview of the data.
23
00:01:18,440 --> 00:01:22,910
You'll see at the top that it gives you some options on just what it is, looking at, what it is using
24
00:01:22,910 --> 00:01:24,740
to actually open the CSV file.
25
00:01:24,740 --> 00:01:27,010
So it tells you what it's using as a delimiter.
26
00:01:27,020 --> 00:01:30,290
And it's also telling you it's doing a preview of the first 200 rows.
27
00:01:30,650 --> 00:01:34,170
Now, in this case, traditionally what we've done is we've used the load button.
28
00:01:34,190 --> 00:01:38,780
However, we're going to move across and we're actually going to use transform data and this is going
29
00:01:38,780 --> 00:01:41,870
to open up our power query for us to use.
30
00:01:42,800 --> 00:01:48,560
So the power query has now opened, and what you're going to see is it's broken up into a number of
31
00:01:48,560 --> 00:01:49,520
different areas.
32
00:01:49,520 --> 00:01:50,990
So I'm first going to cover those areas.
33
00:01:50,990 --> 00:01:54,980
We're going to get a bit of an overview, first of power query and how it works.
34
00:01:55,070 --> 00:02:00,140
If we start on the left hand side, you will see that the list of queries are always shown on the left
35
00:02:00,140 --> 00:02:00,520
hand side.
36
00:02:00,530 --> 00:02:04,730
Now at the moment we've only got one query, but you'll find quite often when you start working with
37
00:02:04,730 --> 00:02:08,990
Microsoft Power by quite a bit, you can often get multiple queries pretty quick.
38
00:02:09,500 --> 00:02:15,310
But as I said at the moment we've just got one and the middle part, we've actually got a preview window.
39
00:02:15,320 --> 00:02:16,370
So this is really nice.
40
00:02:16,370 --> 00:02:20,390
It gives us a preview of our data and allows us to see the type of data that we're working with.
41
00:02:20,420 --> 00:02:23,750
More importantly, you're going to see that as we start making changes to our data.
42
00:02:23,750 --> 00:02:27,290
It actually shows us what happens to that data and what the effects are.
43
00:02:28,050 --> 00:02:30,560
On the right hand side, we have something called properties.
44
00:02:30,570 --> 00:02:32,010
This is actually really important.
45
00:02:32,010 --> 00:02:36,360
This is going to be your table name that is going to be used in Power BI.
46
00:02:36,510 --> 00:02:39,120
So what I'm going to do here is I'm actually going to change this.
47
00:02:39,120 --> 00:02:46,020
And instead of employee plus data, we're just going to call this employee and essentially make it master
48
00:02:46,320 --> 00:02:49,920
because this is quite a bit of employee information that we're going to be working with.
49
00:02:50,430 --> 00:02:52,900
Now, below that, we have something called Applied Steps.
50
00:02:52,920 --> 00:02:56,190
So applied Steps actually works something like a macro.
51
00:02:56,220 --> 00:03:01,350
And what happens is that actually steps through these steps one by one starts to the first step and
52
00:03:01,350 --> 00:03:03,870
then sequentially moves through each step.
53
00:03:04,170 --> 00:03:08,280
So this is really nice because it shows you the logical progression that it goes through in terms of
54
00:03:08,280 --> 00:03:09,670
the steps that you're working with.
55
00:03:09,690 --> 00:03:13,980
So when you come back into this and you want to make changes, maybe a bit of time after you've done
56
00:03:13,980 --> 00:03:18,990
your work, it's really nice that you can come in here, just work through it in a logical manner.
57
00:03:19,530 --> 00:03:23,850
We're going to visit this a little bit more as we go through it and we get more steps that are going
58
00:03:23,850 --> 00:03:24,720
to be applied.
59
00:03:25,320 --> 00:03:28,380
Also, if you look at the top, you'll see that there's a menu option.
60
00:03:28,500 --> 00:03:34,470
So just like traditional Microsoft options, you've got your menu and then you've got your ribbon below
61
00:03:34,470 --> 00:03:36,660
this with quite a lot of options.
62
00:03:36,660 --> 00:03:39,780
And you're going to see at first that the number of options can be quite bewildering.
63
00:03:39,780 --> 00:03:43,920
But as you start working with this, you're going to quickly see that it's actually quite easy to work
64
00:03:43,920 --> 00:03:44,400
with.
65
00:03:45,330 --> 00:03:50,100
So let's get an understanding of how we actually transform data using the power query.
66
00:03:50,190 --> 00:03:55,530
So at the moment, what you can see is that I've got the first column actually selected and this is
67
00:03:55,530 --> 00:04:00,270
telling me it's an employee idea, so it's got a name and then also it's got a data type.
68
00:04:00,270 --> 00:04:01,710
So this data type is really important.
69
00:04:01,710 --> 00:04:05,730
If I click on the one, two, three, you'll see that I get a list of the different types of data that
70
00:04:05,730 --> 00:04:06,990
I can actually apply this to.
71
00:04:07,020 --> 00:04:08,900
So different data types that I could use.
72
00:04:08,910 --> 00:04:13,830
So if I wanted to, I could say this is a decimal number at the moment is set to a whole number.
73
00:04:13,830 --> 00:04:15,510
Or I could say this is text.
74
00:04:15,570 --> 00:04:20,339
So let's say, for example, I wanted to say that this was text could click on that and then it will
75
00:04:20,339 --> 00:04:22,280
ask me, do I want to change column type?
76
00:04:22,290 --> 00:04:26,970
Now, at the moment, because I'm doing a change type, what happens is that Microsoft actually looks
77
00:04:26,970 --> 00:04:32,730
at your data when you import it and it actually makes changes to the columns based on what it sees as
78
00:04:32,730 --> 00:04:33,820
a type of data.
79
00:04:33,840 --> 00:04:38,250
So here's asking me, do I want to replace the current step or do I want to add a new step for this?
80
00:04:38,250 --> 00:04:40,500
So we're just going to say we're going to replace the current step.
81
00:04:40,500 --> 00:04:43,290
And you can see now that the text has moved to the left hand side.
82
00:04:43,290 --> 00:04:47,040
And I get an ABC which is telling me that this is a text type.
83
00:04:47,830 --> 00:04:50,620
But you'll also see is that you do get filtering options.
84
00:04:50,620 --> 00:04:56,620
So there's quite a lot of powerful filtering options that you can use with Power BI Query editor and
85
00:04:56,620 --> 00:04:57,700
you'll see the traditional ones.
86
00:04:57,700 --> 00:05:02,320
You can pick things bit by bit or you could use your text filters, for example, where you can find
87
00:05:02,320 --> 00:05:02,560
things.
88
00:05:02,560 --> 00:05:05,260
Again, something ends with something, contain something.
89
00:05:05,590 --> 00:05:08,740
If you're working with numeric data, you'll see that you can use your number.
90
00:05:08,740 --> 00:05:11,380
Filters find things that are greater than less than.
91
00:05:11,680 --> 00:05:13,390
So they're pretty powerful.
92
00:05:13,720 --> 00:05:17,590
Also, if you're working with the dates, if we go along here, you'll see that you've got a birth date.
93
00:05:17,710 --> 00:05:22,810
If you go to your filter, you'll see that you've got your date filters equals before, after between.
94
00:05:22,810 --> 00:05:25,180
But also it's got some relative dates as well.
95
00:05:25,180 --> 00:05:30,120
So you can find things that are in the next period or the previous period and things like that as well.
96
00:05:30,130 --> 00:05:33,910
So we do have quite a bit of powerful filtering options that you can apply.
97
00:05:34,770 --> 00:05:35,790
Okay, let's move across.
98
00:05:35,790 --> 00:05:38,240
And we got this national ID number.
99
00:05:38,250 --> 00:05:42,870
Now, let's say, for example, I actually do not want this field to be in my analysis.
100
00:05:42,870 --> 00:05:47,160
So what I could do is I can actually right click on this and you'll see that I get an option called
101
00:05:47,160 --> 00:05:47,960
remove.
102
00:05:47,970 --> 00:05:52,710
So when I click on that, it actually now removes the column from my actual table.
103
00:05:52,830 --> 00:05:57,360
You'll also see that a new step has been applied and it tells me that it's removed the columns.
104
00:05:57,360 --> 00:05:59,460
So that's basically the step that's been done.
105
00:06:00,030 --> 00:06:04,890
If I look at the next two fields contact ID and log in ID, I might decide I actually don't want either
106
00:06:04,890 --> 00:06:05,460
of those.
107
00:06:05,460 --> 00:06:08,520
So I can select more than one by using the control key.
108
00:06:08,520 --> 00:06:09,600
Right click on this.
109
00:06:09,600 --> 00:06:13,050
And in this case, now I'd be saying that I'm removing both columns.
110
00:06:14,110 --> 00:06:16,720
Now this one, we've got our manager ID, so that's fine.
111
00:06:16,720 --> 00:06:17,410
I'm going to leave it.
112
00:06:17,410 --> 00:06:19,690
I can see it's a whole number from the one, two, three.
113
00:06:20,200 --> 00:06:25,510
But if we move on to our next option, which says title now I might want to look at this and say, well,
114
00:06:25,510 --> 00:06:28,180
actually, you know, this is actually more of a job position.
115
00:06:28,180 --> 00:06:32,140
So what I could do is I could right click on it and you'll see there's an option to rename it.
116
00:06:32,140 --> 00:06:36,190
Or I could actually just double click on this and then it will allow me to rename it.
117
00:06:36,190 --> 00:06:38,500
So we're just going to call this job position.
118
00:06:38,500 --> 00:06:44,110
And as you can see, I'll just double click in the heading and I can then type in job position and it's
119
00:06:44,110 --> 00:06:46,180
now renamed that field.
120
00:06:46,180 --> 00:06:51,070
And you can see again, I've got a new applied step, so each time I'm adding an applied step, you
121
00:06:51,070 --> 00:06:55,690
can see that it's now just adding that on and it's creating a sequence that we can work on.
122
00:06:56,400 --> 00:06:59,270
Now when we move across to the next one is our birth date.
123
00:06:59,280 --> 00:07:02,950
So when it comes to looking at our data types, data particularly important.
124
00:07:02,970 --> 00:07:06,570
So what I'm going to do is I'm actually going to convert this one back and we're going to just say that
125
00:07:06,570 --> 00:07:07,560
this is text.
126
00:07:07,890 --> 00:07:12,540
So this is traditionally what would have come in on the CSV and Microsoft would have looked at this,
127
00:07:12,540 --> 00:07:17,100
and then it applied automatically that it was a data data type and it converted it.
128
00:07:17,380 --> 00:07:21,360
So let's have a look and see how we would do this if we didn't convert it.
129
00:07:21,520 --> 00:07:26,280
Now, in this case, we're actually using British type of dates, so we've got the date, the month
130
00:07:26,280 --> 00:07:27,090
and the year.
131
00:07:27,630 --> 00:07:32,460
Now when I click on the data types, you'll see an option called using locale.
132
00:07:32,490 --> 00:07:37,290
Now, when it comes to data, often it's a really good idea to use locale because if you've got day,
133
00:07:37,290 --> 00:07:41,930
month, year, then it's going to be different to a month, day, year.
134
00:07:41,940 --> 00:07:44,040
So those are different locales we can use.
135
00:07:44,040 --> 00:07:46,710
So I'm going to say using the call, we're going to convert this.
136
00:07:47,930 --> 00:07:52,610
And in this case, we want to convert it to a date and we're going to use the locale is going to be
137
00:07:52,610 --> 00:07:54,050
the English United Kingdom.
138
00:07:54,140 --> 00:07:59,780
But you'll see that on this list, there's actually quite a large range of different types of dates.
139
00:07:59,810 --> 00:08:03,210
Now, obviously, the one that also gets used is English United States.
140
00:08:03,230 --> 00:08:08,480
So if you did have month, day, year, then you would actually say that you're using that locale.
141
00:08:08,630 --> 00:08:12,920
And in this case, it is the English United Kingdom, and it shows that it's got some examples here
142
00:08:12,920 --> 00:08:16,010
of what it would convert to say on this.
143
00:08:16,010 --> 00:08:21,650
And you can see that it's now successfully converted that to using the UK locale.
144
00:08:22,660 --> 00:08:24,070
Can we get a move across now?
145
00:08:24,070 --> 00:08:27,310
What we've got in this column is the marital statuses.
146
00:08:27,520 --> 00:08:32,860
And you can see I've got m and se, so that could stand for married and single, for example.
147
00:08:32,860 --> 00:08:38,140
And what I might want to do in my data analysis is actually have the words married and single actually
148
00:08:38,140 --> 00:08:39,610
in my data analysis.
149
00:08:40,240 --> 00:08:42,039
So let's say we're going to do that.
150
00:08:42,039 --> 00:08:47,020
So what I'm going to do is I'm going to select this and right click and we'll see that there's an option
151
00:08:47,020 --> 00:08:48,770
called place values.
152
00:08:48,790 --> 00:08:49,960
So this is really nice.
153
00:08:49,960 --> 00:08:52,720
What this allows me to do is to say that I'm going to find the hm.
154
00:08:52,750 --> 00:08:57,310
Now, please note this is case sensitive, so we've got to say we're finding a capital M We're going
155
00:08:57,310 --> 00:08:59,170
to replace this with married.
156
00:09:00,090 --> 00:09:01,740
And I'm going to click okay.
157
00:09:02,160 --> 00:09:06,780
Now you can see on the step, the applied step, now that all the marrieds, all the names have been
158
00:09:06,780 --> 00:09:07,830
changed to married.
159
00:09:08,410 --> 00:09:09,420
I'm going to continue with this.
160
00:09:09,450 --> 00:09:10,880
We're going to replace values.
161
00:09:10,890 --> 00:09:15,550
And what I want to do is with the SE, I'm going to actually purposely misspell this.
162
00:09:15,570 --> 00:09:18,540
So I'm going to say instead of single, I'm going to say single.
163
00:09:18,690 --> 00:09:20,220
So we're going to put that in there.
164
00:09:20,580 --> 00:09:22,410
And you can see now it's changed those.
165
00:09:22,410 --> 00:09:24,750
I know it's incorrect, but we're going to correct it just now.
166
00:09:24,840 --> 00:09:28,140
We're going to move across to gender because gender, we actually do the same thing.
167
00:09:28,140 --> 00:09:29,900
We're going to say replace values for that.
168
00:09:29,910 --> 00:09:32,790
And in this case, now we're going to use M for male.
169
00:09:34,030 --> 00:09:35,950
And we use female.
170
00:09:35,950 --> 00:09:40,450
So again, just right click on that and we're going to say now in this case that we're going to replace
171
00:09:40,450 --> 00:09:41,200
the values.
172
00:09:41,510 --> 00:09:43,510
I'm going to say a female.
173
00:09:45,570 --> 00:09:47,990
Okay, so now we've got four replaced values.
174
00:09:48,000 --> 00:09:52,920
And one thing I want to show you is that if you go back in this list and say, I click on the first
175
00:09:52,920 --> 00:09:59,430
replace values, do you see how my preview window now changes to show me what it looks like at this
176
00:09:59,430 --> 00:10:00,450
point in time?
177
00:10:00,600 --> 00:10:04,430
So it's not now got the next three replaced values being shown.
178
00:10:04,440 --> 00:10:10,650
So please note if you do click back, you'll see now how the preview window will change according to
179
00:10:10,650 --> 00:10:11,820
where I've selected.
180
00:10:12,390 --> 00:10:16,950
The next point that I want to make is you'll see that this little gear icons and what this allows me
181
00:10:16,950 --> 00:10:21,750
to do is actually to be able to change and to be able to replace options.
182
00:10:21,840 --> 00:10:24,210
So I now made a mistake with this second one.
183
00:10:24,210 --> 00:10:29,640
So I'm going to click on the gear icon and you can see that I've got SE and instead of shingle, I should
184
00:10:29,640 --> 00:10:30,660
have said single.
185
00:10:30,750 --> 00:10:33,180
I can now come into this and I'll just click okay.
186
00:10:33,720 --> 00:10:36,840
And you'll see now that it's correctly, now updated that.
187
00:10:37,260 --> 00:10:42,900
Now, when I jump back to this step, do you see how the male and female has now been put into the preview
188
00:10:42,900 --> 00:10:43,560
window?
189
00:10:44,250 --> 00:10:49,020
Another thing that you can do is if you right click on this is you can actually rename the step.
190
00:10:49,080 --> 00:10:52,590
So what I could do is I could say SX to single.
191
00:10:53,160 --> 00:10:58,680
So if I come back to this in a couple of weeks time and I looked at the set of Applied steps, then
192
00:10:58,680 --> 00:11:00,600
I would know what those would actually mean.
193
00:11:00,600 --> 00:11:05,850
So if I went through each one of these, I could actually rename it and I could listed also you will
194
00:11:05,850 --> 00:11:10,800
see that you can move items so you can move before and after If you wanted to move the step.
195
00:11:10,830 --> 00:11:14,210
Also, you do not have an undo facility here.
196
00:11:14,220 --> 00:11:18,810
What you do is you actually click on the delete icon and when you click on the delete icon, it will
197
00:11:18,810 --> 00:11:20,010
remove that step.
198
00:11:21,060 --> 00:11:21,330
Okay.
199
00:11:21,330 --> 00:11:24,390
So at this point, what we're going to do is we're going to conclude this lesson.
200
00:11:24,390 --> 00:11:26,700
I'm going to continue with this in the next lesson.
201
00:11:26,700 --> 00:11:27,450
I will see you there.
20785
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.