0:00In 2020.2, Tableau have enhanced set
0:04control, so they now observe context.
0:08You could argue this might have been a bug
0:10previously, but it's actually classed as a
0:11feature in this particular release.
0:13Let me show you what that is.
0:14It's a very nuanced thing.
0:15You might not have come across it.
0:17I'm going to do a very simple view just to
0:19showcase this feature.
0:20I'm just going to connect to Superstore
0:22Sales.
0:22I'm not going to do anything fancy.
0:24I'm going to bring in subcategories into
0:26the view so we can see them, and I'm just
0:28going
0:28to put sales.
0:30Actually I'm going to put it onto columns
0:32so we can get a nice bar chart.
0:33I'm then going to create a set using a sub
0:37category, and I'm just going to pick the
0:41first few and
0:42click OK.
0:43Then I'm going to right click on that and
0:45then show the filter.
0:47So basically this set control option, you
0:49can see here that I'm seeing the filter fit
0:51in and out of the set.
0:53I'm going to bring it onto detail, and I'm
0:55also going to show the set itself so I can
0:57see the set controls.
1:00You need to be paying attention to this set
1:01control list because this is going to be
1:02the
1:03easiest way to showcase what I'm talking
1:05about.
1:06Just this section here on the left hand
1:08side, you can see the set filter itself
1:10here, and
1:11this is the set control added in the
1:15previous version of Tableau.
1:18If I then bring category onto filter here,
1:20so you can see I'm only going to select the
1:23furniture items and then hit apply, notice
1:26that my view changes but my set control
1:29over
1:30here doesn't change.
1:32So I'm only selecting the Office Applies
1:35now, the view is changing, but my set
1:38control options
1:39isn't observing the context.
1:41I shouldn't have the ability to select
1:43something that's not actually in context.
1:46So what you have to do is essentially add
1:49this category item here to the context, and
1:52you can see it's so nothing's changing, but
1:54now if I go down here to this dropdown, I
1:56can now select this option which says all
1:59values in context.
2:00When I do that, the set control changes
2:03ever so slightly.
2:04So you can see here, this is after the
2:07context has been set in the control, and if
2:09I go back,
2:10this is before.
2:11So the list now preserves what's in context
2:15.
2:15So the user can't choose something that's
2:17not actually in front of them if that makes
2:19sense.
2:20This is really important because obviously
2:21in the visualization, everything is
2:22changing
2:23as we'd expect.
2:24And this is because of a feature in Tableau
2:26called Order of Operations.
2:28It's not actually a feature, it's a
2:30behavior of how Tableau works.
2:31Let me just bring that into view so you can
2:33see that here in a little bit more detail.
2:36So let's just actually make this fit the
2:37screen a little bit better.
2:39And so when Tableau's computing
2:41calculations, a bit like in maths when you
2:43're doing multiplication
2:44and division, there's an order in which you
2:46're supposed to do those things.
2:48And Tableau's Order of Operations actually
2:50starts with extra filters at the top, then
2:52data source filters, then context filters,
2:55then set.
2:56And the issue there has been that sets
2:58actually sit a bit above everything else.
3:00So actually when we put the category filter
3:02into the view and we're filtering things in
3:04and out, it's coming after the set has been
3:06computed.
3:07And that's why the set control on the right
3:09-hand side isn't showing the correct thing.
3:12And so by having that option to make set
3:14observe the context, it's just making it
3:17behave in
3:18a slightly better way, rather than just
3:20observing all values in the database, which
3:22it calculates
3:23here in this context filters sort of step
3:26just before that actually.
3:29And it's much, much easier to see.
3:31That's pretty much the feature in a
3:32nutshell.
3:33It's a little bit obtuse and the
3:35implications of this are actually, well,
3:37you have to use
3:38sets a lot to actually run into this issue.
3:41And the implications just make it easier to
3:43make sure that users are only selecting the
3:45things they're supposed to.
3:46And you could have done hacks in the past,
3:48but this is just tightening up that feature
3:50a little bit more.
3:51If you've enjoyed this video, subscribe to
3:53the channel.
3:53If not, let us know what you'd like to see
3:56more of in the comments below and I'll see
3:59you in the next video.