Creating an Ask data lens: New in Tableau 2021.2
Ask Data lenses finally let you publish one rich data source, then carve out focused perspectives so viewers can ask the right questions.
- Ask Data lenses let you publish one full data source, then create focused 'perspectives' on top of it rather than maintaining separate cut-down data sources for Ask Data.
- A lens can only be created from a published data source on Tableau Server or Online, never from a data source embedded inside a workbook.
- Within a lens you can select which fields are exposed, add synonyms for fields, and hide irrelevant metrics to keep the question experience focused.
- Recommended visualisations become smarter over time as users ask questions and pick chart types, which Tableau captures and surfaces back in the lens.
- You can build multiple lenses from a single data source, each with its own permissions and fields, and they appear as a distinct asset type in Tableau.
- What Ask Data lenses solve0:09
- Building the data source in Desktop1:45
- Creating days-to-ship and order-size calculations2:36
- Publishing the data source7:28
- Creating a shipping lens9:03
- Selecting fields and adding synonyms12:00
- Recommended visualisations and chart types13:43
- Creating a second profitability lens17:27
- Key workflow caveat and next steps18:50
0:00Hey, it's Tim here. In today's video 2021.2
0:03is out and I'm going to be covering the new
0:05feature, the very top of the page about ARS
0:08data.
0:09Now, when you start to unpick ARS data in
0:11this release, there's actually a couple of
0:13things that are sort of worth breaking out
0:15into separate videos.
0:16And so that's what I'm going to do in this
0:17one. The thing I'm going to touch on today
0:19is this specific thing here called ARS data
0:21lenses.
0:22Now, ARS data lenses have been added to
0:24essentially make it easier for viewers to
0:26engage with ARS data content.
0:29Essentially, the problem that you used to
0:31have before is as an editor or creator, you
0:33'd publish up a data source to ARS data.
0:35But sometimes some data sources just have
0:37so many fields.
0:39So you had to do a lot of your work on
0:40desktop before you publish the data source
0:42up to make that work.
0:44Now, the problem then is that your
0:45published data source couldn't be used for
0:47anything else.
0:48So you ended up with this sort of really
0:49weird economy of data sources.
0:51And so what they've done is they've
0:52essentially separated those two things out.
0:55You can go ahead and publish your full data
0:57source with all the fields that you want.
0:59And then you do something called creating a
1:00lens, which basically allows you to narrow
1:03in on the questions that a viewer might ask
1:04of that data source into just a few fields
1:07with some synonyms and some obviously, you
1:09know, some prep done in advance to make it
1:11easier for the user, even down to things
1:13like recommended chart types.
1:15So in this video, I'm going to show you how
1:17that works.
1:18And in other videos, I'll obviously talk
1:20about ARS data.
1:21But if you're sort of really keen on ARS
1:22data, I've already made lots of videos
1:24about how it works.
1:26And there's obviously some nuance to that.
1:28Some of it has been improved and updated
1:29over time.
1:30So again, we'll cover that in future videos
1:31.
1:32But today, we're just going to be creating
1:34an ARS data lens.
1:35And so if you're a creator, this is
1:36essentially a video for you.
1:37I'm going to go right from the beginning.
1:39I'm going to create a data source in
1:40desktop, publish it up, and then we're
1:41going to go from there.
1:43OK, let's get stuck in.
1:45OK, so I'm obviously on the Tableau
1:46homepage.
1:47I'm just going to switch over to Tableau.
1:49I am actually indeed running.
1:50I need to make sure I'm running the right
1:51version of Tableau here.
1:53So let's go and make sure. Yes, there you
1:54go.
1:55You got 2021.2.
1:57Now, I'm going to connect to Superstore.
1:59I'm going to connect to the American one,
2:00which is the second data source here.
2:02Sometimes you have one, sometimes you have
2:03two.
2:04But essentially, I'm going to create to
2:05connect to this one because it's a little
2:07bit simpler.
2:08OK, now what I want to do is before I
2:09publish this data source up to my Tableau
2:12online or Tableau server,
2:14I just want to do some work to create some
2:16fields that people would commonly need.
2:19So I'm going to create two lenses and these
2:21think of these as two perspectives.
2:23I'm going to create a profitability
2:24perspective and a shipping perspective so
2:26we can sort of make it easy.
2:28So I need to do the pre-work to make sure
2:29that those fields and calculations are
2:32already done and embedded in the published
2:35data source before I publish it up.
2:36So we've already got a profit ratio
2:38calculation.
2:40But what I don't see if I go to ship date,
2:42we've got the ship date and we've got the
2:44order date.
2:45And so what I'd like to do is create a new
2:46metric, which is essentially just a date
2:48difference between those two.
2:50So let's go ahead and create a calculated
2:52field.
2:53I'll just bring the dates and now I've got
2:55my little emoji keyboard that's fired up
2:57here and the globe key.
2:59So let's go and create dates here.
3:02And oh, it doesn't doesn't want to know
3:03about that. So let's just let's type an
3:05order date and let's type in ship date.
3:09OK, so we've got those two in.
3:11I'm just trying to think which is the best
3:12way to do this.
3:13I think it's normally a good idea to do
3:15that this way around.
3:18And so I'm not done here yet. I'm just
3:19bringing the field so that I know what I
3:21need to do.
3:22And if I then just type date diff here, you
3:25'll see that this is the function that comes
3:26up and it shows you how it works.
3:28Date diff, the part, start date, end date,
3:30start of the week.
3:32So essentially what I can do is I can just
3:35put here in days and I can just say start
3:39date, which is the ship date and end date.
3:42Is that really the right way around?
3:45I'll go along with it. So what I'll do is I
3:46'll grab this. I'll grab this and put this
3:49here.
3:50I never really know how it's just calculate
3:52the answer and then figure things out.
3:54So days to ship. And what we can do is we
3:55can actually grab an order and check this
3:57and make sure this works.
3:59Let's just create that. It should be a
4:00numerical field, which is correct.
4:03And let's just grab an order ID and we can
4:05add all of them.
4:07This is totally fine on my machine. So I
4:09was going to bring in the order date.
4:11Let's just bring in the exact order date
4:13and that will take a bit of time.
4:15I'm obviously not building a very optimized
4:17view here and this is going to compute that
4:20a little bit.
4:21And then I'm going to drag the ship date. I
4:23'm going to actually I could have just gone
4:25for a discrete date to be honest.
4:26I didn't need the exact date.
4:28And it's being really sort of I was being
4:30really not smart in that instance.
4:32I can tell I'm a bit rusty. So let's let's
4:35just wait for this to load.
4:37OK, there we go. So let's let's just choose
4:41day in this case.
4:43And what we'll do is we'll keep that
4:44discrete in both instances. I could have
4:46just right click, drag this out and then
4:47chosen the exact date.
4:49I don't know why I didn't do that.
4:51Sometimes you have these habits and they
4:53kind of stick with you and you end up just
4:56being a little bit slow.
4:59And also I'm doing this to 5000 marks. So
5:01it's trying to draw this every single time.
5:04You know what I'm going to do? I'm going to
5:06be smarter and just keep only the first
5:08three orders.
5:10That will make everything a lot, lot
5:12smoother. And we can just go in here and do
5:15this so we can see the the order date.
5:19Now, what I should really do is do this,
5:20then I can better see what's going on.
5:23So here we go. OK, so we've got the two
5:25dates and if I just bring those to ship as
5:28a number, you can see that this is all
5:30negative.
5:31And it's because of the way we've done it.
5:32We've done the start date minus the end
5:34date, which obviously gives you a negative
5:36number.
5:37So if we just switch these around. So if
5:39you actually if we actually do this, let's
5:43do this so you can see the order in which I
5:44'm doing the math.
5:45So that's the start date and that's the
5:47date it ships. So it says minus six because
5:49that minus that is is is six less.
5:52So let's just go in here and just switch
5:54these around so we don't have to.
5:57The other thing we could do is we could
5:59just put a minus in front of this. We don't
6:01have to switch those around.
6:02I could be lazy and do that. And because of
6:03that, you know, amazing things happen. So
6:07seven to six, that's six days.
6:10So now we have that calculation there. That
6:12's really, really good to go. And I have a
6:14profit number, have days to ship.
6:16And the key thing to understand is
6:18obviously, you know, we need to be able to
6:21make sure that everything is set up.
6:24The other thing I'd love to know is the
6:26average order size. So for this one, I'm
6:29actually going to use an LOD.
6:30If you haven't used an LOD or you're not
6:32sure what they are, I've actually done a
6:34series of LODs.
6:36Go check it out. I'll put a link in the
6:37description or pop up on the screen for
6:39this for you to see.
6:41So anyway, for this one, we're going to do
6:43fix the order ID. I would love to know the
6:47average sales.
6:49This one, essentially, I want to just know
6:51the average value of items in the order.
6:54That gives me sort of an inclination about
6:55how big the order is.
6:57OK, so or I could just do I could just do
7:00the size of the order. Actually, that's a
7:03much better proxy.
7:04Let's just do some of sales in that case.
7:07So this just tells me the size of the order
7:10.
7:11And there we go. So size of the order as a
7:14LOD and we hit apply. And now we've got
7:17those two fills.
7:19So size of order, days to ship. We've got
7:21profit to profit ratio and profitability
7:23also.
7:24You could call it that as well. And now we
7:25're pretty much good to go. I'm not going to
7:26do much more.
7:28I'm going to go ahead and publish this to
7:29server. So I'm actually already connected
7:32to the Tableau Online instance that I use
7:34for demos.
7:35You'll see that it just pops up here. The
7:36way you know that, for example, is if you
7:39go up to the server and you just select
7:41this little little arrow here,
7:43just go to server there at the top, and
7:45then you'll see that it says you're signed
7:47in and even tells you which server you're
7:49signed into.
7:49If you're signed into the wrong site, then
7:51you're also able to go in and change that
7:53just by going to the arrow section that's
7:55up there.
7:56So anyway, we're back here in Tableau and I
7:57'm going to publish this to the 2021.2
8:00folder.
8:01I'm going to call this sample superstore
8:03data source.
8:05OK. And this is this is a prerequisite of
8:09lenses.
8:10You can't create a lens from a data source
8:12that's embedded inside of a workbook.
8:15It's really, really important to be aware
8:16of. OK, so just call this test lens data
8:20source.
8:21Data source. Great, great, great.
8:24Everything looks good.
8:25So now when we publish that, this is going
8:27to send up this data source up to Tableau
8:30online in this case.
8:32And we're pretty much going to be ready to
8:34go.
8:35So now that we're here, we're ready for the
8:37next step in terms of creating this lens.
8:39Now, we can obviously schedule an extract
8:40here. We don't need to do that.
8:42If you're connected to a database, you
8:44might be able to do that and do whatever
8:46you need to do.
8:47Now, previously with our state, this was
8:49actually the place you started to ask.
8:52Our state just sort of dropped you hot into
8:53all of these fields and you could do some
8:55customizations.
8:56But even so, it kind of meant you had to
8:58publish separate data sources for our state
9:01to compare to the other data sources.
9:02So what you can now do if I just go over
9:05here, if you just see where it says new, if
9:07I go to this dropdown,
9:09you'll see that I now have a new option
9:10here, which is the ability to create a lens
9:11.
9:12Now, this is really interesting because it
9:13's like a perspective.
9:15It's like a window into your data. And what
9:17you're doing is you're creating these sort
9:19of perspectives in these windows.
9:21So people can have very focused set of
9:22questions and actually also makes it easier
9:25for people to sort of contextualize the
9:26kind of topic they have in mind when you
9:28create a lens.
9:29And these lenses can be saved and they're
9:30just like any other asset in Tableau.
9:33So permissions and everything work
9:34alongside them.
9:36And yeah, they're just this nice sort of
9:37way of focusing people's attention.
9:40I think that's always something that's
9:41lacked.
9:42You've just had a world of data source in a
9:43world of workbooks, but it's always been
9:46hard to really narrow in on a specific sort
9:48of problem.
9:50You know, we build dashboard sometimes for
9:51that, but sometimes you don't need a
9:53dashboard.
9:54You just need like a sort of a filter on a
9:56set of rows and lenses on that.
9:59But you'll see what you see what they can
10:00do with them in a second. So I'm going to
10:02go ahead and create a lens.
10:04In this case, I'm going to call this twenty
10:07twenty contact twenty twenty one hyphen to
10:10the lens example.
10:12And actually, no, what I'm not going to
10:15call it, I'm going to call this twenty
10:18twenty one to shipping lens.
10:21Let's just call this shipping lens.
10:23And now that we've done that, we're going
10:25to put that in this folder and say for
10:28shipping inquiries.
10:30OK, great. And I'm going to publish the
10:34lens now.
10:35When you publish this lens, it's obviously
10:37going to go and send you off to a page.
10:40It's almost like you've published a work
10:41book. And now here we have our shipping lens
10:44and notice that it's different to last day
10:46because you have this sort of icon.
10:47And this icon is sort of consistent across
10:49all of Tableau.
10:51OK, so you can see that this is now a new
10:53asset type that you can work with now.
10:56Now that I'm in my lens, I can do a bunch
10:57of different things. I can obviously
10:59minimize and close this window.
11:01You see the fields that we sort of saw
11:03before. You can obviously go in here and
11:05start typing questions.
11:07So average duration to ship and you'll see
11:10that it guesses that I'm talking about the
11:14days to ship number.
11:18And so if I just do that and then enter, it
11:22will obviously think about it and go off
11:25and hopefully build a visualization or
11:27return a number.
11:29And you see that the average days to ship
11:30is three point nine five eight.
11:32Now, what I've just done there was
11:33basically the old experience with last data
11:35.
11:36I just used that type to question. I didn't
11:37look for a lens. I haven't even customized
11:39anything here.
11:40So let's go ahead and actually I'm going to
11:42go back to my lens and we're not going to
11:44use this just yet, but you can start to see
11:45some of the benefit here.
11:47So now now we have our lens. You can see
11:50that it has all the same capabilities so
11:52you can move them, you can manage their
11:53permissions.
11:54When you go into the permissions, you've
11:56got all the same capability that you used
11:57to have with permissions in Tableau.
12:00Now, when you go to each individual field,
12:02you can start to be a little bit more
12:05specific.
12:06So, for example, you can see here that I
12:08have customer names and I can just say this
12:10another synonym for this could be a
12:12customer.
12:13And I can click like that and I can go in
12:15here and you see location here as obviously
12:18a hierarchy and it tells you what it is.
12:21You can go in and see the location. That's
12:22kind of important for shipping the order
12:24date, the order ID, the product.
12:27I don't need to know much about the
12:28profitability, if I'm honest.
12:30So what I could decide to do in this lens
12:32is sort of hide this particular field.
12:35So what I'm going to go and do is click on
12:37this data field and you'll see that I get
12:39this ability to select fields.
12:42Now, there's a little bit of sort of weird
12:43ness with the tablet documentation that
12:45calls it fields here, but there it says
12:48data.
12:49So it's sort of not obvious that that's
12:50where you go.
12:51You might think you're going to edit the
12:52data, but actually it should be filled.
12:54I think this is probably just a hangover or
12:55bug or something that hasn't been sort of
12:57cleaned up.
12:58And this is actually a modal window so you
12:59can move it around, do whatever you want.
13:02And now you can actually choose what you
13:03want to focus in on.
13:05I don't need anything to do with
13:06profitability in this particular data
13:09source.
13:10I've obviously got the ship date and the
13:11ship mode.
13:12I don't need anything about discount,
13:14profit.
13:15I would like to know the quantity. I would
13:17like to know the sales and size of order.
13:20And then I need to know whether the I don't
13:21really need to know where the items return
13:23because that's for the returns department.
13:25OK, I don't need to know about profit ratio
13:27or the top customers by profit.
13:30Now, when I do that and I submit, you'll
13:32notice that my list on the left hand side
13:34is now a lot more narrow.
13:36I don't have anything to do with profit and
13:37that's ready to go.
13:39And now I can start using this to sort of
13:41gain some sort of insight.
13:43Now, as more people use this, as more
13:45people ask questions, you will see that you
13:48have recommended visualizations.
13:50And these are sort of semi smart.
13:52So the most obvious ones appear once our
13:54status analyze your data.
13:56You can obviously go in and it will change
13:58those.
13:59You've obviously got some day and time
14:00questions.
14:01You've got some filters here and you can
14:03essentially create these and edit these as
14:05you like.
14:06So, for example, if I want to maybe change
14:08the this type.
14:09So let's say I want to get rid of pie
14:10charts because I don't like pie charts.
14:12So I can go ahead and remove that and you
14:13'll see that that sort of disappears
14:15straight away.
14:16If I go ahead and collapse that, that's all
14:18fine.
14:19If I click on this edit title, you can
14:20obviously change this sort of group of
14:22recommendation types.
14:24This is sort of just sort of it's just a
14:26way of nicely grouping the questions.
14:30They're not the sort of although Tableau is
14:32giving you a suggestion that these are
14:34filtered, these are date and time.
14:36You could actually rename these groups and
14:38put your own set of questions sort of into
14:40these areas.
14:41Now, the way this actually works is when
14:43asked data is used by someone and someone
14:45actually clicks on it.
14:47It's like they validated that that's a
14:48valid question to ask.
14:50And then the visualization that sort of
14:51captured there is sort of captured with
14:53that.
14:54Now, the list of visualization that that
14:55comes from, I'll show you where that is.
14:58So let's just say let's just go back to our
15:00average days to ship question and let's
15:03just hit that.
15:05And if we go and just hit submit on this
15:07particular lens, another thing you'll
15:10notice when I do that is now the context of
15:14where I started my question is actually the
15:16shipping lens.
15:17So in terms of just browsing, it also makes
15:19it a lot easier.
15:20Notice my fields are still the same reduced
15:22set of fields.
15:23Just focus on shipping.
15:24Now, the list of visualizations you can
15:25choose from depend on what you build.
15:28So you can see here that I've asked a very
15:29basic sort of question here.
15:31So you get bar chart, text table and hist
15:33ogram.
15:34However, if I was to say average days to
15:39ship by location.
15:42OK, and I can obviously add some context to
15:44this because you'll see that it suggests as
15:46a map because it thinks locations and maps
15:48that sort of go together.
15:50So let's do that and let's hit that.
15:53And to now your search can't be applied to
15:54this visualization because, of course, it's
15:57in this sort of particular context.
15:59So let's just clear everything.
16:01Let's try this again. Average days to ship
16:07by city.
16:09I think that's a valid question you would
16:11ask.
16:12And this time it's worked.
16:14I think the problem was is that I was
16:15trying to do it having already asked the
16:16question.
16:17I needed to clear it first.
16:18Maybe that wasn't as obvious to me.
16:20But you can see here that it's drawn a map.
16:22And obviously, when I go to do the dropdown
16:23now, you can see the thing I was trying to
16:25show you a few minutes ago is that this
16:28question is now up to date.
16:30And you can see the chart types have sort
16:32of popped up.
16:33So if I then choose a chart type here, let
16:35's say a heat map doesn't really make sense
16:38in this context.
16:40A map is really the best one.
16:42And if I do a tree map, it's going to be
16:43basically all going to be generally the
16:45same because the size of the box represents
16:47the average days to ships.
16:49That's not really that interesting.
16:51But what I'll do is I click a few of these
16:52anyway so you can sort of see the output.
16:55And then what we're going to do is actually
16:56clear all of this and go back to our
16:58shipping lens.
16:59And when we go back to our shipping lens,
17:02essentially what's happened is I've given
17:03Tableau some information so it knows, OK,
17:06someone's asked some questions here and
17:08they've asked for these specific chart
17:09types.
17:10So you can start to see that if I go to the
17:13vis types, you can see it's all it keeps it
17:16keeps defaulting to some.
17:19But you can see that it's obviously
17:20starting to look at the questions I'm
17:22asking and it's sort of bringing those in,
17:23which is quite nice.
17:25So that's essentially a lens in a nutshell.
17:27It's very, very simple.
17:28Now, the great thing is you can create
17:29multiple lenses.
17:31So what I can do is I can go back to my
17:33data source and I can go ahead and create
17:35another lens.
17:37And this time I'm going to call this 2021-2
17:42Profitability Lens.
17:44OK, and I go ahead and publish that lens.
17:48And now that it's published, you sort of
17:50have to create the lens before you can do
17:52stuff with it.
17:53Right. So now that you've created the lens,
17:55you've now sort of jumped into your little
17:57sort of spot of focus.
17:59Go ahead, hit the pencil icon.
18:01If you're wondering where that was, it was
18:03just I brought the wrong thing in there.
18:05Let's grab the arrow and just point it out
18:07there so you can see that there it is.
18:10Now, what I can do is I'm obviously still
18:12interested in things like location, the
18:14order.
18:15I might be more interested in the customer,
18:17but I definitely don't need the shipping
18:18mode and the shipping date,
18:21because that's sort of not really relevant
18:23for me.
18:24The discount, profitability, quantity and
18:26size of order are all useful and I don't
18:28need to know whether it's returned or not.
18:30So let's just hit submit.
18:32And now you'll see that my list updates
18:34have now got no information there about
18:36shipping and it's all been driven off the
18:38one data source.
18:39So if I go back to my 2021-2 folder, you'll
18:43see that I have my data source.
18:45I have two lenses, profitability lens and
18:47shipping lens, and you're now ready to go.
18:50OK, so that's a very simple video on how to
18:51create the lenses.
18:53Now, what I've actually been having over
18:54here on the right hand left hand side of my
18:56screen, sorry, actually, you're you're
18:58probably right hand side.
19:00So if I actually open this table, I have a
19:01nice guide. I'll put this in the
19:03description below about creating lenses,
19:05everything you can do, everything you can
19:06create. And I think it's a really good
19:08place to go.
19:09And then the next video I'm about to record
19:11now, which is about our data and adding
19:14that lens to a dashboard.
19:16The really important thing, I can't stress
19:18this enough, is that you can't use this
19:20lens feature on a data source that's
19:22embedded inside of a workbook.
19:24So if you want to use as data lens to a
19:26dashboard, you have to start with a
19:27published data source in your workbook in
19:30the first place.
19:31You can't just connect to a data source and
19:32only have that embedded in the workbook.
19:35It has to come from Tableau server. And
19:37that is a big sort of workflow change.
19:39So that's just something to be aware of and
19:41make sure that you sort of get into.
19:43So that's pretty much it. I'm going to stop
19:45this video here and then the next one, I'll
19:47talk about adding an ask data window into
19:50your dashboard.
19:51So you can obviously let viewers and
19:52everyone else use this amazing feature
19:54because in this release, viewers now have
19:57access to it.
19:58Catch you in the next one.
“Tableau authors create separate Ask Data lenses, which query a selected subset of fields. For the selected fields, authors can specify synonyms for field names and values, reflecting terms the lens audience uses in common language (for example, “SF” for “San Francisco”). Lens authors then customize the recommended visualizations that”
0:00 Intro 1:50 Setting up a published data source 7:20 Setting up the lens 10:40 Customising the lens 17:35 Creating an alternative lens from the same data source