Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:05,120 --> 00:00:06,310
Welcome to this lesson.
2
00:00:06,320 --> 00:00:10,010
In this lesson, we're going to be looking at our date field in a lot more detail.
3
00:00:10,070 --> 00:00:12,780
We're going to be looking at how we can use our calculate columns.
4
00:00:12,800 --> 00:00:14,150
So I'm going to go back to my report.
5
00:00:14,150 --> 00:00:20,510
I cleared those previous tables we were using, but let's say we go back to creating a new table and
6
00:00:20,660 --> 00:00:22,880
make a bit bigger and we've got a sales date.
7
00:00:22,880 --> 00:00:27,830
If we drop the sales date into the table, you'll see now that we've got our sales date, which is made
8
00:00:27,830 --> 00:00:30,560
up of our hierarchy of year, quarter, month and day.
9
00:00:30,590 --> 00:00:33,520
So it now shows those within the table.
10
00:00:33,530 --> 00:00:36,650
But what would happen if we just want to show the year by itself?
11
00:00:37,070 --> 00:00:40,310
So as we know, we can remove these, but that's quite a lot of hard work.
12
00:00:40,310 --> 00:00:44,990
And also it doesn't always give us the amount of flexibility that we might want when we're creating
13
00:00:44,990 --> 00:00:45,710
our reports.
14
00:00:45,710 --> 00:00:48,680
What we might want is just year as its own field.
15
00:00:48,920 --> 00:00:49,970
Okay, So we're going to have a look.
16
00:00:49,970 --> 00:00:51,680
We're going to see how we can create that.
17
00:00:51,680 --> 00:00:56,510
So let's go back to our data and we're going to add a new column again.
18
00:00:56,510 --> 00:01:00,410
So in this case, I can just go up to my table tools, go to new column.
19
00:01:00,410 --> 00:01:01,580
We're going to select that.
20
00:01:01,580 --> 00:01:04,590
Our formula bar will come up, hopefully getting used to this.
21
00:01:04,610 --> 00:01:06,110
Now, the same rules apply.
22
00:01:06,110 --> 00:01:07,670
We must always have a field name.
23
00:01:07,670 --> 00:01:09,590
So in this case we're going to call it year.
24
00:01:09,620 --> 00:01:13,280
It's perfectly acceptable to call it a function name so we can call it.
25
00:01:13,280 --> 00:01:16,730
Yeah, just make sure it's not the name of a field that already exists.
26
00:01:16,730 --> 00:01:18,470
Then the system will have a problem with it.
27
00:01:18,860 --> 00:01:25,010
When I say year equals and in this case we're going to now say put a Y into the system.
28
00:01:25,010 --> 00:01:30,580
And what you'll see is that return all of the functions that begin with the Y, so very much like Excel.
29
00:01:30,590 --> 00:01:36,590
So Power BI uses a formula language called Dex, and Dex is very similar to the Excel function language
30
00:01:36,590 --> 00:01:37,910
in a number of aspects.
31
00:01:37,910 --> 00:01:42,200
It is actually more powerful than a number of other aspects, but you'll tend to find that with your
32
00:01:42,200 --> 00:01:47,300
Excel knowledge you can actually get up and going very quickly with Power BI and using the DAX formula
33
00:01:47,300 --> 00:01:47,950
language.
34
00:01:47,960 --> 00:01:49,970
So as I said, it works in a similar way.
35
00:01:49,970 --> 00:01:54,980
We're going to use the year function, so we're going to select that and you'll see now that it actually
36
00:01:54,980 --> 00:01:58,760
gives me an explanation that says, Yeah, what is the date we're going to be using?
37
00:01:58,760 --> 00:02:01,850
It's also got an open parentheses like we would find in Excel.
38
00:02:01,850 --> 00:02:06,530
So in this case we want to know what is the year of the sales date.
39
00:02:06,530 --> 00:02:11,390
So again, I can use my left square bracket, I can open that, We can go down in our fields.
40
00:02:11,390 --> 00:02:13,100
We see that we've got our sales date there.
41
00:02:13,100 --> 00:02:14,210
We're going to select that.
42
00:02:14,210 --> 00:02:19,340
So basically we're going to be now creating this formula which says the year field is going to equal
43
00:02:19,340 --> 00:02:21,590
the year function of the sales date.
44
00:02:22,310 --> 00:02:24,230
Okay, let's press enter on that.
45
00:02:24,230 --> 00:02:30,050
And you can see now that new field has been created, which just has the year itself, whereas the sales
46
00:02:30,050 --> 00:02:32,480
dates, I've got the full sales date in there.
47
00:02:32,750 --> 00:02:40,850
Now if we go back into our report and create a new table, we'll now see that we've got our year field.
48
00:02:40,850 --> 00:02:43,760
And you can see again, it's got the calculated column icon.
49
00:02:43,760 --> 00:02:44,930
Drop that in there.
50
00:02:45,050 --> 00:02:48,830
Now you can see straight away we do have a bit of a problem because it's the summing of the year, but
51
00:02:48,830 --> 00:02:49,670
we'll fix that now.
52
00:02:49,670 --> 00:02:51,470
So we're going to put our sales in there.
53
00:02:51,680 --> 00:02:52,720
So we've got our sales.
54
00:02:52,730 --> 00:02:54,380
Let's go back to the sum of the year.
55
00:02:54,380 --> 00:02:58,010
And in this case, we're going to say we don't want to summarize this.
56
00:02:58,010 --> 00:03:02,870
So you can see when we say done summarize, it's now showing me each individual value of my year, which
57
00:03:02,870 --> 00:03:04,040
is exactly what I want.
58
00:03:04,040 --> 00:03:07,310
And I've now got my sum of sales for each one as well.
59
00:03:07,310 --> 00:03:08,240
So that's perfect.
60
00:03:08,240 --> 00:03:09,730
That's exactly what I wanted.
61
00:03:09,740 --> 00:03:14,960
However, in the future you may find that you don't want your year to sum at all, so you can select
62
00:03:14,960 --> 00:03:20,480
the year, you can go to your column tools and you see in your default method of summarization that
63
00:03:20,480 --> 00:03:24,470
you can change it from some and you just say, I don't want this to summarize.
64
00:03:24,590 --> 00:03:30,230
This should now change the default that if we create a new table, hopefully this will work, create
65
00:03:30,250 --> 00:03:34,280
a new table, and let's just drop a year in there that it should.
66
00:03:34,280 --> 00:03:34,880
There we go.
67
00:03:34,880 --> 00:03:36,170
It doesn't summarize.
68
00:03:36,170 --> 00:03:37,340
So that's really helpful.
69
00:03:37,340 --> 00:03:40,760
We've got those figures in there, so I'm going to delete that.
70
00:03:41,060 --> 00:03:41,750
So let's go back.
71
00:03:41,750 --> 00:03:43,250
Let's look at another example.
72
00:03:43,250 --> 00:03:47,630
So let's say, for example, we wanted to know what is our month number.
73
00:03:47,630 --> 00:03:50,600
So we've got a year, let's go and add our month number.
74
00:03:50,600 --> 00:03:53,510
So I'm going to say new column and we're going to say month.
75
00:03:54,500 --> 00:03:56,540
And going to say month equals.
76
00:03:56,930 --> 00:04:01,580
And in this case, you'll see that there is actually a function called month, just like Excel.
77
00:04:01,730 --> 00:04:07,460
Again, you'll see that when I typed in Mo N, you'll see a whole bunch of new functions that are available
78
00:04:07,460 --> 00:04:09,570
in Dex that you may not know from Excel.
79
00:04:09,590 --> 00:04:12,670
And as I say, really, please just go and research those.
80
00:04:12,680 --> 00:04:13,910
You'll see there's quite a lot.
81
00:04:14,030 --> 00:04:16,130
Now you'll see that the same syntax applies here.
82
00:04:16,130 --> 00:04:18,290
We got a month function or we're entering.
83
00:04:18,290 --> 00:04:19,970
Here is the month of which data.
84
00:04:19,970 --> 00:04:21,920
In this case it is of the sales date.
85
00:04:22,340 --> 00:04:26,070
So we're going to select sales date again, close our parentheses.
86
00:04:26,090 --> 00:04:26,870
So there we go.
87
00:04:26,900 --> 00:04:30,710
Month equals the month function of the sales date.
88
00:04:31,040 --> 00:04:35,210
And again, when I press enter on this now, you'll see that we get a new month being created.
89
00:04:35,210 --> 00:04:36,100
And there we go.
90
00:04:36,110 --> 00:04:37,790
We've now got that information.
91
00:04:38,270 --> 00:04:41,110
So as you can see, this one, September, that's number nine.
92
00:04:41,120 --> 00:04:43,070
And again, we could go back to our report.
93
00:04:43,430 --> 00:04:45,920
So we've got our existing report with our year.
94
00:04:45,950 --> 00:04:47,570
Let's change this to a matrix.
95
00:04:47,960 --> 00:04:53,570
And let's say that now in the column we wanted to use our month number and there we go.
96
00:04:53,600 --> 00:04:59,300
Now, you've got a traditional management report that is now showing us all our month numbers going
97
00:04:59,300 --> 00:05:00,030
across.
98
00:05:00,050 --> 00:05:02,930
And we've got our years going down in our rows.
99
00:05:03,410 --> 00:05:04,150
So there we go.
100
00:05:04,160 --> 00:05:05,660
That's how we would create all month.
101
00:05:05,660 --> 00:05:07,940
And again, you can do the same thing, just click a month.
102
00:05:07,970 --> 00:05:13,160
Make sure in your summarization you would say you don't want it to summarize as the default, except
103
00:05:13,160 --> 00:05:16,110
that we're going to look at a couple more examples.
104
00:05:16,220 --> 00:05:18,410
So let's go back into our data.
105
00:05:18,440 --> 00:05:22,820
Let's say we wanted to know what was the day of the month so we could go again.
106
00:05:22,820 --> 00:05:23,690
New column.
107
00:05:24,620 --> 00:05:26,840
And we're going to create a new field called Day.
108
00:05:27,050 --> 00:05:28,430
I'm going to say de equals.
109
00:05:28,430 --> 00:05:30,590
In this case, it's going to be the day function.
110
00:05:30,980 --> 00:05:34,310
Open your parentheses square bracket.
111
00:05:34,340 --> 00:05:35,240
Go down to your cells.
112
00:05:35,240 --> 00:05:35,840
Date.
113
00:05:36,290 --> 00:05:37,190
Select that.
114
00:05:38,070 --> 00:05:39,670
Close your parentheses.
115
00:05:39,690 --> 00:05:40,380
Enter.
116
00:05:40,650 --> 00:05:41,460
And there we go.
117
00:05:41,460 --> 00:05:44,250
Now you've got the day that you could use in your reports as well.
118
00:05:44,430 --> 00:05:46,200
I'm going to create a couple more here.
119
00:05:46,200 --> 00:05:50,250
And what we're going to look at is all weekday.
120
00:05:50,250 --> 00:05:55,500
So often what you want to do is you may want to know what is the week day like?
121
00:05:55,500 --> 00:05:56,190
Is it a monday?
122
00:05:56,250 --> 00:05:58,170
Is it a Tuesday and Wednesday?
123
00:05:58,320 --> 00:06:01,500
So we're going to use a function called equals weekday.
124
00:06:01,740 --> 00:06:06,990
So let's go and create a new column again and you'll see weekday.
125
00:06:08,670 --> 00:06:09,870
And we're going to say equals.
126
00:06:09,870 --> 00:06:14,790
And in this case, just like Excel as well, you'll see that there is a function called equals weekday.
127
00:06:14,970 --> 00:06:18,990
Also, if you're interested in the week number, you will see that this equals week num, just like
128
00:06:18,990 --> 00:06:20,380
you've got it in Excel as well.
129
00:06:20,400 --> 00:06:26,730
In this case let's just use equals weekday and again we're going to be using our sales data as the input
130
00:06:26,730 --> 00:06:27,390
to this.
131
00:06:28,450 --> 00:06:30,610
And he went to that.
132
00:06:30,880 --> 00:06:34,450
Now what you get is you get a result showing you one through to seven.
133
00:06:34,600 --> 00:06:36,430
Let's actually have a look in a report.
134
00:06:37,000 --> 00:06:38,980
Let's delete this existing report.
135
00:06:41,530 --> 00:06:43,540
Select that to use a new table.
136
00:06:44,670 --> 00:06:48,150
So if we use weekday now, we dropped it in there again, it summed it.
137
00:06:48,150 --> 00:06:50,630
So we're going to say you don't want to summarize.
138
00:06:50,950 --> 00:06:52,680
You can actually change the default.
139
00:06:53,600 --> 00:06:54,890
So don't summarize.
140
00:06:54,980 --> 00:06:55,730
There we go.
141
00:06:55,820 --> 00:06:59,900
So now we've actually got the different sales on each day of the week.
142
00:07:00,170 --> 00:07:04,790
However, if you gave this report to somebody else, it may cause a bit of a problem because the question
143
00:07:04,790 --> 00:07:06,740
would be is what is week day one?
144
00:07:06,770 --> 00:07:07,460
Is it a Sunday?
145
00:07:07,490 --> 00:07:08,060
Is it a monday?
146
00:07:08,060 --> 00:07:08,910
Is a Tuesday.
147
00:07:08,930 --> 00:07:11,180
Do we know is a7a Sunday?
148
00:07:11,210 --> 00:07:12,230
We're not sure.
149
00:07:12,860 --> 00:07:17,930
So what you might want to do is actually use the name of the actual weekday.
150
00:07:18,650 --> 00:07:20,630
So at this point, I'm going to conclude this lesson.
151
00:07:20,630 --> 00:07:25,040
We're going to continue this lesson into the next lesson, and we're going to be looking at how we can
152
00:07:25,040 --> 00:07:26,390
create our weekday names.
153
00:07:26,390 --> 00:07:29,330
We're going to look at month names, so we're going to look at some of the formatting and things that
154
00:07:29,330 --> 00:07:30,890
we need to do around that.
155
00:07:30,890 --> 00:07:32,570
But I will see you in the next lesson.
14043
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.