Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:05,390 --> 00:00:06,230
In this activity.
2
00:00:06,230 --> 00:00:10,200
We've got a few questions that our sales manager would like us to answer.
3
00:00:10,220 --> 00:00:13,700
So I'm going to continue to use this table that we were using previously.
4
00:00:13,700 --> 00:00:14,810
I'm just going to make a bit wider.
5
00:00:14,810 --> 00:00:17,540
We're going to be adding a few calculations in here.
6
00:00:17,690 --> 00:00:21,410
So I just want to take you back, though, to the data model before we move forward.
7
00:00:21,420 --> 00:00:28,220
I just want to say again, please note that these calculations are not adding any new data into our
8
00:00:28,220 --> 00:00:29,120
actual table.
9
00:00:29,120 --> 00:00:33,410
So when you're creating a calculate column, which we did in the previous section, it creates a new
10
00:00:33,410 --> 00:00:35,720
column and creates a result per row.
11
00:00:35,720 --> 00:00:40,490
When we're doing the measure, what it's doing is it's creating a calculation that is being performed
12
00:00:40,490 --> 00:00:41,690
within the visualization.
13
00:00:41,690 --> 00:00:44,090
So it's not adding anything to our tables.
14
00:00:44,090 --> 00:00:47,240
All it's doing is actually adding a new calculation here.
15
00:00:47,600 --> 00:00:48,560
Please note that.
16
00:00:48,710 --> 00:00:50,180
Okay, so we're going to look at the first one.
17
00:00:50,180 --> 00:00:52,490
It wants to know what is the total order quantity.
18
00:00:52,670 --> 00:00:54,980
So again, we can create a new measure on this.
19
00:00:54,980 --> 00:01:00,590
Just click on new measure and we're going to say this is our total order quantity.
20
00:01:00,590 --> 00:01:02,840
And again, we're going to be saying equals.
21
00:01:02,840 --> 00:01:05,060
And in this case we're going to continue to use sum.
22
00:01:05,060 --> 00:01:07,460
So again, we're going to be opening our parentheses.
23
00:01:07,460 --> 00:01:11,780
And in this case, we want to take our data table and our order quantity field.
24
00:01:11,780 --> 00:01:17,610
We're going to select those two and basically just have that been some press enter on that.
25
00:01:17,630 --> 00:01:22,490
And again, now we find that we've got a new field, total order quantity, drop that in there.
26
00:01:22,490 --> 00:01:25,250
And again we have we got this selected as our field.
27
00:01:25,250 --> 00:01:32,390
We could actually then just select all formatting and you'll see now that we've put 1000 separator in
28
00:01:32,390 --> 00:01:34,820
there, the next one is our average sales.
29
00:01:34,820 --> 00:01:38,810
So what you're going to see is just like Excel, we do get the ability to use our different methods
30
00:01:38,810 --> 00:01:42,080
of aggregation be equal, average equals min equals max.
31
00:01:42,290 --> 00:01:44,060
And I show a couple of examples of that.
32
00:01:44,360 --> 00:01:44,720
Right?
33
00:01:44,720 --> 00:01:46,520
So let's go to our new measure.
34
00:01:46,520 --> 00:01:50,990
And in this case, it's going to be our average sales that we're going to be creating as a new calculation.
35
00:01:50,990 --> 00:01:52,400
We're going to say equal to that.
36
00:01:52,400 --> 00:01:58,850
And as we start typing in average as a function, you'll see that we get average, average, average.
37
00:01:58,880 --> 00:02:00,040
So we get different option.
38
00:02:00,050 --> 00:02:04,040
We're just going to use the average for this and we're going to be averaging our sales.
39
00:02:04,040 --> 00:02:07,220
So we go down to our data or sales, select that.
40
00:02:08,050 --> 00:02:08,400
Close up.
41
00:02:08,410 --> 00:02:09,250
Parentheses.
42
00:02:09,250 --> 00:02:10,240
Very important.
43
00:02:10,570 --> 00:02:11,440
Press enter.
44
00:02:11,650 --> 00:02:12,190
And again.
45
00:02:12,190 --> 00:02:14,830
Now we get our new field average cells.
46
00:02:14,830 --> 00:02:16,600
So we're going to add that to our table.
47
00:02:16,820 --> 00:02:17,660
Okay, So there we go.
48
00:02:17,680 --> 00:02:19,120
We've got it added to our table.
49
00:02:19,120 --> 00:02:20,920
And again, we can do our formatting.
50
00:02:21,460 --> 00:02:23,320
Just remove those decimal places.
51
00:02:24,390 --> 00:02:26,580
And there we got our average sales field.
52
00:02:27,130 --> 00:02:27,950
Okay, let's move on.
53
00:02:27,960 --> 00:02:29,430
We want to know the highest sales.
54
00:02:29,430 --> 00:02:31,590
So we're going to be using our equals max for that.
55
00:02:31,590 --> 00:02:36,420
We're going to be looking for the highest individual sales transaction for each of the different countries.
56
00:02:36,690 --> 00:02:38,390
So we're going to say new measure again.
57
00:02:38,400 --> 00:02:41,970
So in this case, we're going to set highest sale.
58
00:02:42,660 --> 00:02:46,680
And just remember when I was saying that earlier that when you're creating these measures, the name
59
00:02:46,680 --> 00:02:49,140
you're using must be unique within the data model.
60
00:02:49,140 --> 00:02:54,030
So you're going to find that naming of your fields will become interesting as your models become bigger
61
00:02:54,030 --> 00:02:56,280
and bigger and you're creating more calculations.
62
00:02:56,280 --> 00:02:58,620
So just something to be careful of.
63
00:02:58,650 --> 00:03:01,230
So in this case, we're just using the equals max function.
64
00:03:01,230 --> 00:03:03,620
We want to know what was the maximum sale.
65
00:03:03,630 --> 00:03:07,050
And again, we're going to be looking at odd data fields.
66
00:03:07,050 --> 00:03:08,730
So we're going to say equals max.
67
00:03:08,730 --> 00:03:11,340
So we're going to say in this case, we're going to look for data.
68
00:03:11,430 --> 00:03:16,920
And you can see as I started typing day, it takes me to my data table and we can go down to our data
69
00:03:16,920 --> 00:03:22,410
sales and we're going to be saying that our hi sale is the max of our sales.
70
00:03:22,890 --> 00:03:28,830
Again, press enter on that, get our highest sale, drop it in there and again, I can do my formatting.
71
00:03:30,420 --> 00:03:35,070
Fix that up and then I'll get each of the country's highest sale been displayed.
72
00:03:35,250 --> 00:03:38,610
So the highest sale, the lowest sale will obviously be our men.
73
00:03:38,610 --> 00:03:43,980
So we're going to now again create a new measure and we're going to say our lowest sale.
74
00:03:44,910 --> 00:03:45,690
Equals.
75
00:03:46,230 --> 00:03:47,820
In this case, it's going to be all men.
76
00:03:48,120 --> 00:03:53,610
And again, we're going to be going to our data table, go down to our sales.
77
00:03:54,090 --> 00:03:54,810
Select that.
78
00:03:55,710 --> 00:04:01,500
So again, in this case, our low cell will equal the min of our data table Sales Field.
79
00:04:01,530 --> 00:04:01,830
Press.
80
00:04:01,830 --> 00:04:02,430
Enter.
81
00:04:02,920 --> 00:04:03,690
There we go.
82
00:04:03,720 --> 00:04:05,880
Got our new calculation.
83
00:04:05,880 --> 00:04:07,380
Lowest sale pinching.
84
00:04:07,410 --> 00:04:08,610
That's because it's pretty small.
85
00:04:08,610 --> 00:04:11,460
So I'm going to actually leave the decimal numbers for that.
86
00:04:12,180 --> 00:04:16,649
So they've seen that we can use our equals average equals min equals.
87
00:04:17,519 --> 00:04:19,890
And the next one wants to know the number of customers.
88
00:04:19,890 --> 00:04:24,540
So what I've seen previously in the course that we have a function called equals distinct count.
89
00:04:24,750 --> 00:04:26,220
So we're going to be using that for that.
90
00:04:26,220 --> 00:04:29,550
We're going to count the number of customers that we have on our data table.
91
00:04:29,970 --> 00:04:34,860
So we're going to start off with our new measure and we'll say in this case we want to go number of
92
00:04:34,860 --> 00:04:35,700
customers.
93
00:04:36,640 --> 00:04:38,250
I'm going to use our equals again.
94
00:04:38,250 --> 00:04:41,970
And in this case, we're using a function called distinct count.
95
00:04:42,090 --> 00:04:46,260
Again, as you can see, as I start typing this again, quite a lot of functions.
96
00:04:46,380 --> 00:04:49,350
Please note, though, that we're going to use the distinct count.
97
00:04:49,380 --> 00:04:53,100
Now, in this case, I know there's no blanks in my dataset, but you may want to use blank.
98
00:04:53,100 --> 00:04:53,700
No blank.
99
00:04:53,700 --> 00:04:57,230
If you do have the possibility of nulls or blanks within your dataset.
100
00:04:57,480 --> 00:05:02,070
I'm going to use distinct count function, and in this case we're going to be counting the number of
101
00:05:02,070 --> 00:05:02,550
customers.
102
00:05:02,550 --> 00:05:04,050
So we're going to go to the customer field.
103
00:05:04,050 --> 00:05:07,380
So we're going to go to the data table and we're going to choose our customer field.
104
00:05:07,590 --> 00:05:09,350
Close up parentheses on that.
105
00:05:09,360 --> 00:05:13,040
Again, press enter and drop that in there.
106
00:05:13,050 --> 00:05:16,170
And you can see that we now have the number of customers.
107
00:05:16,170 --> 00:05:17,430
So not entire dataset.
108
00:05:17,430 --> 00:05:23,610
We have 633 unique customers and then it's showing us for each of our subregions how many customers.
109
00:05:23,940 --> 00:05:27,000
So our last one is what is the average sale per customer?
110
00:05:27,000 --> 00:05:30,200
So this is very much like a calculation that we did in the previous lesson.
111
00:05:30,210 --> 00:05:34,800
What we want to do is we want to take our total sales in this case though, and divide it by our number
112
00:05:34,800 --> 00:05:35,610
of customers.
113
00:05:35,610 --> 00:05:38,340
So we're going to use the same function that we did in the previous one.
114
00:05:38,340 --> 00:05:40,080
We're going to use a divide function.
115
00:05:40,350 --> 00:05:45,420
Now, please note that a divide function is is a really nice function within index, because what happens
116
00:05:45,420 --> 00:05:51,510
is that if you get a divide by zero error, it actually just gives you zero as the response.
117
00:05:51,780 --> 00:05:52,860
And you can actually change that.
118
00:05:52,860 --> 00:05:55,560
If you want a different response, you can actually change it to a different one.
119
00:05:55,560 --> 00:06:00,420
But most of the time if you get to divide by zero, if you give zero as your actual answer, to be honest,
120
00:06:00,420 --> 00:06:02,070
that's normally appropriate.
121
00:06:02,250 --> 00:06:05,790
So it's nice that it covers that that option that you can have.
122
00:06:06,060 --> 00:06:07,920
So we're going to say new measure for this.
123
00:06:07,920 --> 00:06:12,360
And in this case we're going to call it average sale per customer.
124
00:06:13,780 --> 00:06:17,980
And we're going to say equals and again, we're going to use our divide function.
125
00:06:18,620 --> 00:06:20,410
So we're going to use divide.
126
00:06:21,340 --> 00:06:22,300
Bring it up again.
127
00:06:22,420 --> 00:06:23,140
There we go.
128
00:06:23,560 --> 00:06:26,350
And again, you'll remember that the first part is our numerator.
129
00:06:26,380 --> 00:06:31,330
Now, when I press my left square bracket, you'll see that I've got a lot more measures that have been
130
00:06:31,330 --> 00:06:31,810
created.
131
00:06:31,810 --> 00:06:36,250
Now as we've been going along in this this activity, we've been creating new ones.
132
00:06:36,280 --> 00:06:40,570
We still, though we want to use our total cells as our numerator, comma.
133
00:06:40,870 --> 00:06:45,520
And again, I'm going to press the left square one, and we wanted to divide by the number of customers.
134
00:06:45,640 --> 00:06:47,500
So we're going to select a number of customers.
135
00:06:47,620 --> 00:06:49,660
Close our parentheses in this case.
136
00:06:50,230 --> 00:06:52,420
And let's press enter on that.
137
00:06:52,660 --> 00:06:55,300
And you'll see that we've got our new calculation there.
138
00:06:56,260 --> 00:06:57,760
So it's just like that.
139
00:06:58,760 --> 00:06:59,670
Just click on it.
140
00:06:59,690 --> 00:07:02,200
And there we have our average sale per customer.
141
00:07:02,210 --> 00:07:04,250
And again, we could just do our formatting.
142
00:07:05,410 --> 00:07:06,280
And that.
143
00:07:06,640 --> 00:07:12,610
So as you can see, once we're creating these calculations, they're now being used within the context
144
00:07:12,610 --> 00:07:15,980
of your actual visualization.
145
00:07:16,000 --> 00:07:20,710
So again, if we go back to our data model, you'll see that they have not been added into the table
146
00:07:20,710 --> 00:07:21,370
itself.
147
00:07:21,400 --> 00:07:23,550
They're just a calculation that can be used.
148
00:07:23,560 --> 00:07:29,770
So if we created now, for example, a new visualization, let's say another column chart and let's
149
00:07:29,770 --> 00:07:35,100
say you wanted to know what was the average sale for each of your categories, for example.
150
00:07:35,110 --> 00:07:39,520
So drop categories in there, use your average sale in your y axis.
151
00:07:39,940 --> 00:07:44,860
You will see then that will be just calculated as any other calculation.
152
00:07:45,730 --> 00:07:47,830
So hopefully those examples make sense.
153
00:07:47,830 --> 00:07:49,620
We're going to conclude the activity there.
154
00:07:49,630 --> 00:07:50,890
I'll see you in the next lesson.
14303
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.