Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,620 --> 00:00:05,750
All right time to cover one of the most important lectures certainly in the data modeling section but
2
00:00:05,750 --> 00:00:08,120
perhaps in the entire course.
3
00:00:08,120 --> 00:00:14,060
Let's talk about filter flow now to demonstrate that you use a very simple example here you've just
4
00:00:14,060 --> 00:00:21,440
got a three table model two data tables sales and returns both with valid connections or relationships
5
00:00:21,740 --> 00:00:24,440
to a single look at Territory look up.
6
00:00:24,440 --> 00:00:29,900
Now when you look closely at the two relationships you'll note the filter directions which are shown
7
00:00:29,900 --> 00:00:37,030
as arrows point from the one side of the relationship or the lookup side to the many side the data side.
8
00:00:37,280 --> 00:00:44,300
And when you filter any table that filter context is passed along through that relationship line to
9
00:00:44,390 --> 00:00:49,610
all related downstream tables following the direction of the arrow.
10
00:00:49,670 --> 00:00:55,510
And by contrast filters or filter context cannot flow upstream.
11
00:00:55,670 --> 00:00:59,050
In other words it cannot flow against the direction of the arrow.
12
00:00:59,360 --> 00:01:05,420
So you can almost think of these relationships as filter wires because that's all that relationships
13
00:01:05,450 --> 00:01:10,300
do is they pass filter context back and forth between tables.
14
00:01:10,340 --> 00:01:15,620
Quick protip one thing you may have already noticed that I've been doing is that I like to arrange my
15
00:01:15,620 --> 00:01:20,390
lookup tables above my data tables in every data model that I build.
16
00:01:20,570 --> 00:01:27,110
And that just helps serve as a visual reminder that filters flowed down stream from those lookups down
17
00:01:27,110 --> 00:01:28,840
to your data tables.
18
00:01:28,850 --> 00:01:34,100
So let's look at a visual representation of why filter flow is so important.
19
00:01:34,100 --> 00:01:39,110
We're going to look at that same simple three table model and let's say we want to analyze sales and
20
00:01:39,110 --> 00:01:42,750
returns broken down by territory key.
21
00:01:42,840 --> 00:01:49,460
Now the only valid way to do that is to use that territory key field from our lookup table.
22
00:01:49,610 --> 00:01:56,060
And when we grab that field from the Look-Up pull it into our matrix rows we see the proper accurate
23
00:01:56,060 --> 00:02:01,670
values for order quantity and return quantity both broken down by territory.
24
00:02:01,670 --> 00:02:07,760
Now the reason we get the correct answer here is because that filter context that we created by using
25
00:02:07,760 --> 00:02:15,560
the territory key in the lookup table is able to pass or flow downstream to both the sales table and
26
00:02:15,560 --> 00:02:16,800
the returns table.
27
00:02:17,000 --> 00:02:22,430
But keep in mind we also have a territory key in the returns data as well as a territory key in the
28
00:02:22,430 --> 00:02:23,620
sales data.
29
00:02:23,630 --> 00:02:27,950
So technically there are three different ways we could try to replicate this view.
30
00:02:27,950 --> 00:02:35,010
So let's take a look at what happens when we try to do that filtering using territory key from our sales
31
00:02:35,010 --> 00:02:41,580
data table will yield the correct order quantities since those come from the sales data table but incorrect
32
00:02:41,640 --> 00:02:43,050
returns values.
33
00:02:43,110 --> 00:02:49,020
And the reason that's the case is that the filter contacts that we created by using territory key in
34
00:02:49,020 --> 00:02:52,350
the sales data table is stuck in this table.
35
00:02:52,350 --> 00:02:58,920
It cannot flow up there this relationship because it can't flow against the direction of the arrow to
36
00:02:58,920 --> 00:03:01,950
filter either the look up or the returns data.
37
00:03:01,950 --> 00:03:07,950
So as a result the return quantity knows nothing about the filter context that was set from using the
38
00:03:07,950 --> 00:03:13,860
territory key in the sales data table and therefore it just returns the same grand total value over
39
00:03:13,860 --> 00:03:15,600
and over and over again.
40
00:03:15,750 --> 00:03:22,560
Now very similar case if we try to use the territory key from the returns table we see the correct value
41
00:03:22,620 --> 00:03:29,220
for the return quantity now but incorrect values for order quantity because the filter context that
42
00:03:29,220 --> 00:03:35,400
we created by using the territory key and the returns data is stuck in the returns data table.
43
00:03:35,400 --> 00:03:38,530
It can't filter the look up or the sales data table.
44
00:03:38,700 --> 00:03:45,420
So just like our last example order quantity now knows nothing about the filter context passed from
45
00:03:45,420 --> 00:03:51,300
the returns data table and therefore returns the grand total over and over and over again in addition
46
00:03:51,300 --> 00:03:51,900
to that.
47
00:03:51,960 --> 00:03:57,990
You'll notice that this table smaller contains fewer rows and that's because only territories that registered
48
00:03:57,990 --> 00:04:04,470
returns are even going to be visible in this table since the filter's taking place within that returns
49
00:04:04,470 --> 00:04:05,580
data table.
50
00:04:05,580 --> 00:04:12,240
So we don't even see data from territories 2 and 3 even though they registered orders.
51
00:04:12,240 --> 00:04:17,790
So this is a little bit tricky to grasp at first but it's an incredibly important concept that's going
52
00:04:17,790 --> 00:04:24,030
to come up time and time again as we start working with more complicated concepts like daks formulas
53
00:04:24,240 --> 00:04:27,410
and interactions between individuals and the report view.
54
00:04:27,540 --> 00:04:34,080
So to really drive this point home Let's hop back into power be-I and build our own matrix visual to
55
00:04:34,080 --> 00:04:37,130
see this filter flow concept for ourselves.
56
00:04:38,430 --> 00:04:43,900
All right back in my report view my Adventure Works file I've got the same matrix that we just showed
57
00:04:43,900 --> 00:04:49,780
in our last video and to follow the demo that we just talked about and then I select the Matrix and
58
00:04:49,780 --> 00:04:54,530
instead of gender here let's go ahead and find our territories table.
59
00:04:54,580 --> 00:04:55,690
There it is.
60
00:04:55,690 --> 00:05:00,840
And we want the sales territory key and drag that into rows.
61
00:05:00,880 --> 00:05:06,760
So just like we're demonstrating We've got 10 sales territories 1 through 10 and we're seeing proper
62
00:05:06,790 --> 00:05:10,450
order quantities and proper return quantities.
63
00:05:10,450 --> 00:05:16,330
And you can see from that last example that territory is 2 and 3 did not register any returns in our
64
00:05:16,330 --> 00:05:18,170
sample so those cells are blank.
65
00:05:18,190 --> 00:05:23,690
So this is an accurate valid view for orders and returns by sales territory.
66
00:05:23,860 --> 00:05:30,130
But just like we demonstrated if we pull sales territory out of the rows and we drill into the actual
67
00:05:30,130 --> 00:05:37,000
sales data itself and grab the territory key from there when we dropped that went into rows.
68
00:05:37,090 --> 00:05:43,930
Now you'll see that return quantity duplicated every single row but you'll still see all 10 territories
69
00:05:44,230 --> 00:05:47,340
because all 10 territories generated orders.
70
00:05:47,590 --> 00:05:54,390
And I think you see where this is going we can pull territory key out drill into our returns table grab
71
00:05:54,400 --> 00:06:01,670
the returns table version of the territory key and there you see that order quantities are now duplicated
72
00:06:02,050 --> 00:06:04,020
returned quantities are correct.
73
00:06:04,310 --> 00:06:10,610
And those two territories that did not register returns don't even show up here in the Matrix because
74
00:06:10,610 --> 00:06:12,760
they were filtered out from the start.
75
00:06:13,040 --> 00:06:20,300
So hopefully this demo starts to give you a sense of why filter flow is so important to understand making
76
00:06:20,300 --> 00:06:26,060
sure that we have a crystal clear understanding of our models filter flow will be critical for making
77
00:06:26,060 --> 00:06:31,490
sure that the views we're creating the filters we're using and the numbers that we're showing are 100
78
00:06:31,490 --> 00:06:32,360
percent accurate.
8987
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.