Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,510 --> 00:00:07,610
OK time to shift gears a little bit and shift our focus towards understanding the language of daks and
2
00:00:07,640 --> 00:00:10,230
we're going to start with the core syntax.
3
00:00:10,230 --> 00:00:13,380
So consider a simple some function like this.
4
00:00:13,440 --> 00:00:19,980
Let's break this down into its component parts starting from the left in gray we have to measure name.
5
00:00:20,130 --> 00:00:25,650
And like I mentioned measures will always be surrounded by brackets when referenced in formulas.
6
00:00:25,650 --> 00:00:27,800
So having spaces here is OK.
7
00:00:28,670 --> 00:00:33,890
Now the next component immediately following the equal sign is the function name.
8
00:00:33,900 --> 00:00:35,540
Now interesting note here.
9
00:00:35,690 --> 00:00:40,510
Calculated columns don't require functions but measures do.
10
00:00:40,670 --> 00:00:46,700
So a calculated column could have what's called a naked reference meaning it points to a column on its
11
00:00:46,700 --> 00:00:53,840
own not an aggregated version of that column and that's OK because calculated columns evaluate row by
12
00:00:53,840 --> 00:00:55,010
row by row.
13
00:00:55,070 --> 00:01:00,980
So you could create calculations for things like discount price like we practice in the query editor
14
00:01:01,250 --> 00:01:07,070
or you are essentially taking the value from another column like retail price and applying some sort
15
00:01:07,070 --> 00:01:08,580
of operation against it.
16
00:01:08,690 --> 00:01:14,960
On the other hand you can't do that with measures if you tried to define a measure with a naked column
17
00:01:14,960 --> 00:01:21,770
reference like transactions quantity to RBI will return an error since it doesn't know how to translate
18
00:01:21,770 --> 00:01:24,000
that into a single value.
19
00:01:24,230 --> 00:01:30,380
So you need some sort of aggregation there and then the last two components here on the table name in
20
00:01:30,380 --> 00:01:33,330
orange and the column name in blue.
21
00:01:33,830 --> 00:01:39,950
And this particular example reflects what's called a fully qualified column since it's preceded by the
22
00:01:39,950 --> 00:01:45,650
table name and like we talked about when we were working with the query editor table names with spaces
23
00:01:45,920 --> 00:01:48,290
have to be surrounded by single quotes.
24
00:01:48,320 --> 00:01:52,560
So here's an example of what that would look like with or without a space.
25
00:01:52,610 --> 00:01:58,250
One piece of advice protip here when you're referencing columns get in the habit of using the fully
26
00:01:58,250 --> 00:01:59,580
qualified name.
27
00:01:59,660 --> 00:02:06,180
So table followed by column but for Measure references just use the measure name itself.
28
00:02:06,200 --> 00:02:12,920
That's a nice easy way to differentiate column references from measure references within your daks formulas
29
00:02:13,360 --> 00:02:17,810
and there are some cases where that may not always make sense but for the most part that's a pretty
30
00:02:17,810 --> 00:02:19,820
good practice to follow.
31
00:02:19,820 --> 00:02:26,650
So moving on let's talk about some common daks operators and most of these are extremely straightforward.
32
00:02:26,690 --> 00:02:32,950
You've got your basic arithmetic operators addition subtraction multiplication division and exponents.
33
00:02:33,140 --> 00:02:35,450
Those pretty much speak for themselves.
34
00:02:35,450 --> 00:02:41,960
You also have your comparison operators equal to greater than less than greater than or equal to less
35
00:02:41,960 --> 00:02:44,300
than or equal to or not equal to.
36
00:02:44,360 --> 00:02:46,820
And I've shown some examples here as well.
37
00:02:46,820 --> 00:02:52,490
And then where it gets a bit more interesting is with the text and logical operators and these ones
38
00:02:52,490 --> 00:02:56,750
are a little bit different from other formula languages that you may be used to.
39
00:02:56,750 --> 00:03:03,260
So one of the consistent ones is using the ampersand as a concatenation tool where you can combine values
40
00:03:03,260 --> 00:03:05,100
to produce a single text string.
41
00:03:05,240 --> 00:03:11,330
But some of the newer ones are the double ampersand which is an AND condition or the double pipe which
42
00:03:11,330 --> 00:03:17,810
is the OR condition and on most PCs you can find that pipe icon by holding Shift and pressing the key
43
00:03:17,810 --> 00:03:19,880
right beneath the backspace.
44
00:03:19,890 --> 00:03:26,600
The fourth example here is called in which creates a logical OR statement based on an entire list contained
45
00:03:26,600 --> 00:03:28,070
within curly brackets.
46
00:03:28,280 --> 00:03:33,390
So little hint if you're only going to pay attention to a couple of pieces from this slide.
47
00:03:33,590 --> 00:03:38,630
Pay attention to these two because these are going to come up a few more times with some of the formulas
48
00:03:38,630 --> 00:03:39,740
that we'll be writing.
49
00:03:40,190 --> 00:03:45,290
So from here we're going to outline some of the most common function categories then begin to add some
50
00:03:45,290 --> 00:03:48,330
new calculated fields to our Adventure Works report.
5542
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.