Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,670 --> 00:00:00,970
All right.
2
00:00:00,970 --> 00:00:07,060
So we've talked quite a bit about filters in the context of our data model and how filter or context
3
00:00:07,060 --> 00:00:10,140
can transmit through table relationships.
4
00:00:10,480 --> 00:00:15,580
But now we're going to talk about filter context and how it impacts daks measures.
5
00:00:15,610 --> 00:00:21,730
So remember the definition of a measure it's evaluated based on filter context which means that those
6
00:00:21,730 --> 00:00:26,650
measures recalculate whenever the fields or filters around them change.
7
00:00:26,650 --> 00:00:30,230
So consider this matrix view on the left side of the screen.
8
00:00:30,420 --> 00:00:37,240
If we pinpoint one cell out of that matrix we can understand exactly what filter context is being passed
9
00:00:37,240 --> 00:00:42,530
to that cell and therefore understand exactly how that measure is being calculated.
10
00:00:42,880 --> 00:00:49,750
So for this particular highlighted cell we're calculating a measure called total orders and it's evaluating
11
00:00:49,750 --> 00:00:56,600
based on the following filter context the product name column from the product table is equal to Turing
12
00:00:56,650 --> 00:01:03,080
tire tube because that's the filter context passed to this cell from the Matrix row labels.
13
00:01:03,100 --> 00:01:05,400
So this is pretty intuitive on the surface.
14
00:01:05,620 --> 00:01:11,740
This allows to measure the total orders measure to return the order quantity for each product specifically
15
00:01:12,160 --> 00:01:15,450
or whatever the matrix row and column labels dictate.
16
00:01:15,450 --> 00:01:19,650
It could be years could be countries product categories customer names.
17
00:01:19,840 --> 00:01:26,080
So again pretty straightforward but what might not be quite so straightforward is the fact that total
18
00:01:26,080 --> 00:01:33,400
or grand total values are not simply calculated by summing the values above they're calculated as their
19
00:01:33,490 --> 00:01:37,890
own unique measures with no filter context.
20
00:01:37,900 --> 00:01:43,570
So in this case since we aren't calculating orders for a specific product in the Total row we're essentially
21
00:01:43,570 --> 00:01:48,090
taking that filter context of product name and ignoring it.
22
00:01:48,370 --> 00:01:55,450
So it's a nuanced concept but a very important idea which is that each measure in a report behaves like
23
00:01:55,450 --> 00:02:02,590
its own island and calculates according to its own unique filter context even totals and Grand Totals
24
00:02:02,590 --> 00:02:03,850
values.
25
00:02:03,850 --> 00:02:09,340
So as I was learning about filter context for the first time and really digging in and trying to wrap
26
00:02:09,340 --> 00:02:15,250
my head around what it really meant what was most helpful for me was working through a number of different
27
00:02:15,250 --> 00:02:17,440
variations of examples.
28
00:02:17,440 --> 00:02:23,250
So let's take a minute to do that right now here I've got a sample view of a dashboard.
29
00:02:23,290 --> 00:02:27,990
This is a piece of a dashboard that we're going to be building in the next section of the course.
30
00:02:28,120 --> 00:02:30,400
And obviously you've got a lot of information here.
31
00:02:30,490 --> 00:02:31,810
Got a matrix on the left.
32
00:02:31,820 --> 00:02:36,190
You've got donut charts combo charts tree maps cetera.
33
00:02:36,190 --> 00:02:42,820
One thing to pay attention to is this report level filter in the lower right that says Year is 2016
34
00:02:42,850 --> 00:02:44,460
or 2017.
35
00:02:44,710 --> 00:02:48,170
We're going to talk all about what those filters mean and how they work.
36
00:02:48,340 --> 00:02:55,270
But for now all you need to know is that this filter applies to every visual and every number that you
37
00:02:55,270 --> 00:02:57,080
see on this entire report.
38
00:02:57,280 --> 00:03:04,150
So from here we can actually pinpoint individual measure values to understand what filter context is
39
00:03:04,150 --> 00:03:05,500
being passed to them.
40
00:03:05,500 --> 00:03:11,640
So for example this first case in the top left or evaluating measure named total revenue the filter
41
00:03:11,650 --> 00:03:20,200
context is that year equals 2016 or 2017 and that the full name from the customer table equals Mr. Larry
42
00:03:20,320 --> 00:03:21,700
Munoz.
43
00:03:21,730 --> 00:03:28,510
So with that filter context in mind the DAX calculation for the total revenue measure evaluates and
44
00:03:28,510 --> 00:03:33,940
spits out the result that we see here in this case it looks like about ten thousand eight hundred fifty
45
00:03:33,940 --> 00:03:35,630
two dollars of revenue.
46
00:03:35,950 --> 00:03:37,910
So look at another example here.
47
00:03:37,960 --> 00:03:43,570
Now we're not looking at an actual numerical value we're looking at a component of a chart which is
48
00:03:43,690 --> 00:03:44,840
built from a value.
49
00:03:45,130 --> 00:03:49,510
In this case this is a donut chart that's tracking total orders by gender.
50
00:03:49,690 --> 00:03:57,400
So the measure driving this segment of the donut chart as filter context of year equals 2016 or 2017
51
00:03:57,850 --> 00:04:04,780
because remember all visuals all charts all numbers in this report will be subject to that report level
52
00:04:04,780 --> 00:04:05,710
filter.
53
00:04:05,710 --> 00:04:11,580
And then the second piece of the filter context is that gender equals F for female.
54
00:04:11,710 --> 00:04:13,220
Similar case here.
55
00:04:13,330 --> 00:04:15,390
We're evaluating total orders again.
56
00:04:15,490 --> 00:04:19,270
Got that same 2016 2017 filter context.
57
00:04:19,270 --> 00:04:24,560
The only difference is that this chart is breaking down orders by occupation.
58
00:04:24,580 --> 00:04:27,840
So in this particular highlighted cell or segment of the donut.
59
00:04:27,910 --> 00:04:34,420
The second piece of filter context is that the occupation field in the Customer table equals clerical
60
00:04:35,230 --> 00:04:36,740
moving down to the bottom left.
61
00:04:36,820 --> 00:04:38,360
Here's an interesting one.
62
00:04:38,410 --> 00:04:42,830
In this case we're looking at the Total row for a measure called total orders.
63
00:04:43,030 --> 00:04:49,720
So even though this value lives in a matrix that's broken down by customer names because this measure
64
00:04:49,720 --> 00:04:56,140
this little island cell needs to calculate the total we're basically calculating orders in the absence
65
00:04:56,230 --> 00:05:01,790
of a filter with the exception of that one page level filter that applies across the board.
66
00:05:01,850 --> 00:05:08,240
So that number twenty two thousand five hundred thirty four reflects the total orders as defined by
67
00:05:08,240 --> 00:05:12,330
the measure formula for 2016 or 2017.
68
00:05:12,650 --> 00:05:18,800
Moving along to this trended view where you've got columns capturing total orders and a line capturing
69
00:05:18,830 --> 00:05:20,860
total revenue by month.
70
00:05:20,960 --> 00:05:28,970
In this case this highlighted column here capturing total orders years 2016 or 2017 and month from the
71
00:05:28,970 --> 00:05:32,480
calendar table is August 2016.
72
00:05:32,810 --> 00:05:37,940
So this one's a little bit interesting because you've got two different filters from the calendar table
73
00:05:38,330 --> 00:05:44,690
being applied and in cases like this it's the more specific filter that's going to take priority.
74
00:05:44,730 --> 00:05:50,990
Now last example looking at this card visual in the report in this case this number is acting almost
75
00:05:50,990 --> 00:05:52,440
like a grand total.
76
00:05:52,490 --> 00:05:59,420
There are no labels or column labels or chart axes or visual level filters that will be impacting the
77
00:05:59,420 --> 00:06:00,650
value shown here.
78
00:06:00,650 --> 00:06:06,500
So what we're looking at is just the total revenue measure subject to those report level year filters.
79
00:06:06,500 --> 00:06:09,310
So hopefully these examples are helpful.
80
00:06:09,350 --> 00:06:13,980
I imagine that you're thinking to yourself you know pretty straightforward pretty intuitive.
81
00:06:14,210 --> 00:06:19,100
But the thing is it does get a bit more complicated and a bit more interesting.
82
00:06:19,100 --> 00:06:26,680
To be honest because these aren't static views these are interactive dynamic dashboards and visuals.
83
00:06:26,750 --> 00:06:33,260
And what I mean by that is that users can drill into components of this report and components of these
84
00:06:33,260 --> 00:06:38,110
visuals in order to drill in and explore this data in different ways.
85
00:06:38,420 --> 00:06:44,720
So you could drill in and isolate a specific row in a matrix or Drilon to filter down to a specific
86
00:06:44,720 --> 00:06:46,340
segment of a chart.
87
00:06:46,460 --> 00:06:53,930
And when that happens more filter context is essentially being added to every single measure shown on
88
00:06:53,930 --> 00:06:55,070
the report.
89
00:06:55,070 --> 00:07:00,620
So what that means is that the context that we see here that we've listed out this is just a snapshot
90
00:07:00,650 --> 00:07:02,840
at one particular point in time.
91
00:07:03,020 --> 00:07:08,780
But if this donut chart for instance that breaks down order by gender was configured to interact with
92
00:07:08,810 --> 00:07:15,380
all of the other visuals in this report page then that means that a user could potentially click on
93
00:07:15,380 --> 00:07:21,680
the female segment and add a new context to every one of these other measures that we've called out
94
00:07:22,070 --> 00:07:27,740
as well as every other measure in the entire page for customer gender equals female.
95
00:07:27,890 --> 00:07:34,100
And if that user then drills deeper into a particular income level segment that adds another line of
96
00:07:34,100 --> 00:07:37,220
filter context to every measure on the page.
97
00:07:37,220 --> 00:07:42,890
So as you can see it can get quite a bit more sophisticated and quite a bit more complicated.
98
00:07:42,920 --> 00:07:48,740
That's why it's really important for us to nail down these fundamentals and understand exactly what's
99
00:07:48,740 --> 00:07:49,840
going on.
100
00:07:49,880 --> 00:07:54,860
So we're going to talk through a number of examples when we start writing daks functions in the second
101
00:07:54,860 --> 00:07:56,080
half of this section.
102
00:07:56,210 --> 00:07:59,170
And then this will come into play in a number of different ways.
103
00:07:59,330 --> 00:08:05,680
In the final section of the course when we actually start building visuals and reports so stay tuned.
104
00:08:05,690 --> 00:08:07,070
Some great stuff ahead.
11405
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.