Over the next few weeks, leading up to the Tableau Think Data Thursday presentation (register now!), I’ll take a look at some fun facts about Tableau 9 Level of Detail calculations. Today, let’s take a look at life before LOD calcs:
In versions prior to Tableau 9.0, Level of Detail (LOD) calculations were not available. That meant that there were only a few ways to effectively work with different levels of detail in the same view:
All of these had potential draw-backs.
Table calculations are relatively easy when you want to work at higher levels of detail in a view (essentially the equivalent of EXCLUDE), but much more cumbersome when working with lower levels (essentially an INCLUDE or FIXED), because you’d have to include dimensions for the lower level of detail in the view and then hide using some kind of First(), Index() or Last() filter to hide the lower level of detail. You can see the difference here: Charting new distinct values per period?
Data blending was often the most effective, because you could control the level of detail for the blend – however, you could run into issues when using DB2 (data blending with fields from the primary source not present in the view) because certain calculations (such as COUNTD) were not allowed. You’d also have to maintain multiple copies of the data source.
Sets were very effective when you needed to work with a level of detail of a single dimension. But you could only get IN/OUT of the set and you couldn’t use multiple dimensions for a computed set. So, you could get a set of every customer with a first purchase in 2014. But you couldn’t get the first year of purchase per customer at a row level.
Totals represent a higher level of detail within a view and there are some work-arounds to customize them — but there’s not a lot of flexibility.
Tableau 9.0 Level of Detail calcs are a real game-changer and Tableau 9 opens up a lot of possibilities for answering questions that would have previously required quite a bit of complexity.
How have LOD calcs changed the game for you? Let me know in the comments. Stay tuned… there’s more to come!
Actually, it’s not dates in Tableau. Tableau does wonders with dates! What other tool allows you to connect to a data source with dates and have a built-in hierarchy where you can move different parts of the hierarchy around in the view? What other tool has its own built-in date dimension? There are imitators – but Tableau did it first.
But it isn’t dates or using dates in Tableau that drives me nuts. So, what is it? It’s the way people have been taught to think of dates in Tableau. It drives me nuts, because ultimately it drives them nuts and they get frustrated and complain and think Tableau is hard and needlessly complex.
But it’s not Tableau – it’s the way they’ve been taught or the way they’ve made assumptions. And actually, it goes deeper than dates. It starts with dimensions vs. measures, and discrete (blue) vs. continuous (green).
Dimensions, Measures, Discrete, and Continuous
Here’s the issue: in an attempt to keep things simple in explanation, accuracy was sacrificed. Consider the following:
Here’s what I think when I see that:
To say dimensions are discrete and measures are continuous is a simplification. Simplification can be good. But not when it’s just flat out wrong. It might appear to be helpful, but really lays a poor foundation of understanding that will limit people from moving forward.
Consider this view:
Not only can I see the number of habitable planets for the Klingons, Romulans, and Federation, but I can also quickly see a count of Neutral Zone Violations as headers in front of the bars. I can do this using a Discrete (Blue) Measure. Yes: it is a measure. Yes: it is discrete. Let that sink in.
It. Is. A. Discrete.Measure.
I made it discrete using the drop down menu on the field:
If I didn’t know I could use a measure as a discrete field in the view, then I might have moved the continuous field all over the place, searching for the perfect view (but never finding it):
So, let’s keep it simple. But let’s also keep it accurate:
Measure: a field that is aggregated (e.g. summed up, averaged, counted, etc…). For example, I can sum up all my Habitable Planets, take an average, or get the minimum or maximum.
Dimension: a field that slices or groups the measures. For example, I want to get the sum of Habitable Planets and the sum of Neutral Zone Violations sliced up by Alignment. Since there are 3 alignments, I’ll get 3 sums (SUM of Habitable Planets and SUM of Neutral Zone Violations for Klingons, for Romulans, and for Federation)
Now, contrast that with:
Discrete (blue): Individual Values – when a field is used as a discrete field in the view, it will define headers and color legends with individual values.
Continuous (green): A Flowing Range of Values – when a field is used as a continuous field in the view, it will define axes and color legends with gradients:
Discrete (blue) fields in action:
Continuous (green) fields in action:
There’s some complexity we could dive into. But we can keep it simple – and without sacrificing accuracy. Here’s the simple thing to remember:
Measure vs. Dimension determines what fields are being aggregated and what fields are slicing/grouping the aggregations.
Discrete vs. Continuous determines how Tableau draws the results (headers, axes, color legends, etc…)
And here’s the secret:
For the most part it doesn’t matter whether a field is in the Dimensions list or the Measures list in the left Data Window. That’s just the default, but once the fields in the view, you can use the drop down to convert almost any field back and forth between Measure and Dimension and between Discrete and Continuous:
In summary: Almost any field in the view can be used as either a Dimension or a Measure. And numeric and date fields can also be used as either Discrete or Continuous.
And with that, you’re on your way to becoming a Tableau Jedi.
Dates in Tableau are not hard…
…at least not if you take some time to understand and use careful, precise terminology. When you right-click a date field in the view in Tableau, or use the drop-down you’ll get a menu like this:
Now admittedly, this is a long list and it might be intimidating at first. But let’s break it down. There’s:
The standard options for a field (Format…, Show Header, and at the bottom: the Tableau 9.0 feature – Edit in Shelf, and Remove)
Show Missing Values
A section of Date Parts
A section of Date Values
A section that allows you to switch between Attribute and various Measure aggregations
A section that allows you to switch between Discrete and Continuous
We’ll skip the standard options and merely mention, for now, that Show Missing Values is simply a way of telling Tableau to include missing dates in a visualization so you can see gaps in time where there is no data.
And just like almost any field, we can use it in the view as a dimension or a measure. And we can use it as discrete (blue) or continuous (green).
The two primary sections that need to be understood are the two sections of dates. The first section is a list of Date Parts. The second section is a list of Date Values.
Date parts are just the individual parts of a date – all by themselves. So a date of November 8, 1980 could be broken down into individual parts:
And when I use just one of those parts as a dimension in a viz, then I’m telling Tableau, “Aggregate all the measures at the level of that date part.” So, for example, when I put a Date on Columns and then select the Date Part of Month, I might get a view like this:
I’m telling Tableau, give me the SUM of sales for each Month (as a date part). Sales on November 8, 1980 are included in the bar above. So are Sales on November 9, 1980. And November 22, 2015. Sales in any November are included.
If I had selected the Date Part of Day then I would have a bar chart of every day (1st through 31st). The 8th would have been any 8th of a Month: November 8, 1980; December 8, 2015; February 8, 2025.
Now, some people have been taught to refer to Date Parts as “Discrete Dates”. This is because when you select a Date Part for a date field, the default is a discrete (blue) field. But it is not accurate to speak of Date Parts as “Discrete Dates”. You can switch a Date Part between Discrete and Continuous. Here’s that view from above after using the field’s menu to make the switch:
Sure, the way Tableau drew the view changed (an Axis instead of headers, formatting the month as a numeric value, making the bars narrower, faint grid lines) – but fundamentally, it’s still giving the SUM of Sales for all Novembers (and Januarys and Februarys, etc…).
Don’t think of Date Parts as “Discrete Dates”. They are “discrete by default’, but the Tableau Jedi can merely wave his hand (or use the right-click menu) and change things as desired.
Date values are indeed the value of the date. Notice that it isn’t just November. It isn’t just 8. It’s November 8, 1980. Or, it’s November 1980. It depends on the level you select.
So take that date and assume it has time included: November 8, 1980 5:46am
Depending on what level of detail you select you’ll get a value that is truncated (lower levels of details getting cut off). Let’s rearrange the date and pretend we’re building a bar chart so we can see it better:
Year Month Day Hour Minute Second
1980 November 8 05 46 00
Year: 1980November 8 05 46 00 – Truncated to the Year. Any date that falls within 1980 will give us a single bar. There will be a bar of every other Year in the data.
Quarter: 1980Q3November 8 05 46 00 – Truncated to the Quarter. Any date that falls within 1980 Q3 will give us a single bar.
Month: 1980November 8 05 46 00 – Truncated to the Month. Any date that falls within November 1980 will give us a single bar. Notice we get a bar for each Month and Year. Notice also that I’ve made the field discrete in the view, which gives headers.
Date: 1980November8 05 46 00
Hour: 1980November8 05 46 00
Minute: 1980November8 05 46 00
Second: 1980November8 05 46 00
Again, some people have been taught that these are “continuous dates.” They are not. They are continuous by default. But you can change them as needed.
Not much to say, except that this is the exact date value in the data. No truncation, no funny business. Just the exact date to whatever precision the data contains (including time if applicable). This one can also be either discrete or continuous (it is continuous by default).
Why it Matters
Because you will no longer get frustrated and wonder why dates are so hard and confusing. They’re not – not really. And you will be able to generate some really cool views and impress your friends and co-workers. You’ll select date parts or values as needed and change them to discrete or continuous at will. You will be a Tableau Jedi.
Today’s Tableau Tip comes from my colleague, David Baldwin. I am privilleged to work with him at Teknion Data Solutions, a Tableau Gold Partner providing data consulting solutions.
David is also Tableau Trainer – travelling the country to teach others how to use Tableau to see and understand their data. One of the questions he often gets is how to convert Tableau into PowerPoint presentations.
Here’s David’s answer:
How to Convert Tableau to PowerPoint
Let’s face it. PowerPoint is ubiquitous and many companies have policies requiring PowerPoint for presentations. Rats! Wouldn’t be so much cooler to put a complete presentation in Tableau including not only data visualizations but images, lines of text and even animation? Alas! Sometimes we have to bow to cultural dictates and put static screenshots of interactive visualizations into a pptx file.
How does one best do this? Below is one approach where, admittedly, I thumb my nose a bit at PowerPoint by starting from a Tableau workbook that has been designed as a “PowerPoint-like” presentation.
Choose “Entire Worksheet” and set the orientation to “Landscape”
Open the resulting PDF in Adobe Acrobat Pro.
Within Adobe Acrobat Pro choose File > Save as Other > Microsoft PowerPoint Presentation. . Note that this selection choice is not available in Adobe Acrobat Standard. Alternatively, you might experiment with other PDF software packages such as Nitro or Foxit. If you do come across a good “free” solution – please tell me in the comments.
Presto! You have a PowerPoint presentation! However, we’re not done yet.
Note in the attached pptx file that the first page is a mess. There’s not a whole lot we can do to fix this. The fastest choice is to just take a screenshot of the first dashboard in the twbx file. The cleaner approach (which may be important if you plan to print the pptx file) is to recreate the page within PowerPoint.
Notice that the pages have artifacts on them. Fortunately, these artifacts are relatively easy to clean up.
To clean up artifacts, within PowerPoint go to View > Slide Master.
Within each Master Slide remove the offending artifacts. (See below.)
With just a little more cleanup work, you should be good to go!
Wouldn’t it be great if there was a way to hide something on a Tableau Dashboard? Something you, the designer wanted to see, but not something the end-user of the published dashboard should see.
Maybe it’s a set of instructions to remind yourself of how quick filters and parameters should be set prior to publishing. Maybe it’s a drop down control for your action filter(s) so you can see what actions have been triggered and easily reset the action. Maybe it’s an email message from the private account of a government official that you want to keep from the prying eyes of the public.
You can place any dashboard item just off the dashboard (in a fixed size dashboard) and when it’s published, the end-user will never see it.
How to get the dashboard item to the hidden place
The only trick is how to get something off the dashboard. If you drag it there you get nothing. Or if it was already on the dashboard, dragging it off is the same thing as removing it.
So instead, place it on the “real dashboard” as a floating item. Then use the Position controls in the lower left to set the X and Y coordinates to position it off the dashboard.
The end result is a published dashboard that hides all the elements that were off the dashboard.
I sure wish I’d known this technique when I developed the Choose Your Own Adventure or BlackJack! dashboards. Then, I created a secondary dashboard with everything on it and a special action filter to “reset” the dashboard as I designed and tested. Instead, I could have just hidden the action filters off-grid and reset as desired.
Check out the dashboard in action:
All the hidden items I added to the dashboard are there, but in order to see all my secrets you’ll have to download the workbook and open it in Desktop…
Like this tip? Please leave a comment – I’d love to hear your feedback. Also look for the Share and Subscribe links if you’d like to keep up with the tips and share the knowledge! Until next time…
The Tableau 9 Data Interpreter and other new data prep options, such as pivot and split, open up new possibilities for connecting to data. No longer will you have to spend all your time fixing data structure and cleaning up headers, footers, and merged cells in Excel. Tableau 9.0 makes that (and more) so much easier so you can get to asking and answering questions and visualizing the data!
The video below is first in a series I will be doing for Teknion Data Solutions. In this video I’ll demonstrate the new data preparation features of Tableau 9, including the new data interpreter.
<shameless plug> I have been working as a consultant with Teknion Data Solutionsfor over 10 years and love it! If you enjoy Tableau (or any aspect of BI) and love to help others, consider joining Teknion’s team of consultants. </shameless plug>
I had a great time presenting this feature and others at DFW TUG! What a turn out! Thanks to everyone who came and for those who made it come together. If you were there (or even not) and have any additional questions leave a comment on this post and I’ll gladly try to answer. I also presented on other new Tableau 9.0 features, including:
New Data Connection Options (Pivot, Split, Data Interpreter)
Level of Detail (LOD) calculations
New Calculation Editor & Ad Hoc Calculations
Drag and Drop Analytics
Fun and Useful Enhancements (color picker, thumbnail preview, map search, new selection options)
Tableau Server Updates
And, now, the video:
(Subscribe to Teknion’s YouTube channel to get updates as new videos are posted)
Sometimes you want to customize titles or even hide titles in Tableau. When shown on a dashboard, titles will always appear, even when you filter out all the data in the view:
Notice how the title stays, even when all the data is filtered and the view isn’t drawn. This can be unsightly, especially in dashboards where I want to guide the user through some exploration. Who wants to see titles of things that aren’t meant to be seen until you take an action?
One way to hide titles in Tableau
1. Create a calculated field with hard-coded string:
I used the aggregation of MIN here to force it to be an aggregation to avoid it interfering with table calcs. (I also suspect that this is would be more performant than a row-level calculation in most cases, but I’m not sure. If you know, please leave a comment…)
2. Place the resulting calculated field on Columns to give you a custom “title” at the top of the view.
3. On the dashboard, you can hide the real title so that everything disappears when there is no data:
That’s not really a “title” it’s just a column header with some formatting. Here are the steps I took to get it to look like a title:
Right-click the column header and select Format
Change the font size
Switch to Borders on the format window and adjust the level of Column Headers.
And now, the title is hidden when the view has no data!
That’s it for this Tableau tip. There’ll be more soon. Subscribe to keep up-to-date!
Previously, we saw how to capture and use Tableau’s automatically generated latitude and longitude for custom geocoding. Now, we’ll extend that technique to give us the ability to drill up and down on various levels of geographic detail in a single visualization:
The data is fairly standard. We have Regions which contain 2 or 3 Areas which contain multiple Zip Codes:
Only Zip Code is recognized as a standard geographic field. Tableau is nice enough to supply the fields Latitude (generated) and Longitude (generated) based on the Zip code. However, we can’t use those fields in calculations or blending. So, we’ll capture them in a separate data source (along with the associated Region, Area, and Zip Code) just like we saw in the previous tip.
Data Blending to Control the Level of Detail
Now we can blend between the two sources on any of the fields they share in common:
But why set the level of detail of the blend ahead of time? This gets much more exciting if we create a parameter and a couple of calculated fields to allow the end-user to control the level of detail of the blend.
Here the parameter:
Then, I’ll create a calculated field that returns the desired dimension based on the parameter selection:
We’ll create this calculation in both the primary and secondary data sources. Why? So we can blend on that field instead of any of the others:
And now, the level of detail of the blend changes with the user selection. Instant geographic drill down (and up again!)
Last time we looked at a simple way to implement custom geocoding in Tableau using the ability to assign latitude and longitude to unknown locations. That’s a fairly good option if you only have a few locaitons and only need to plot marks on a map or two in a single workbook. But what happens if you have a lot of locations? Or what if you want to reuse the solution in multiple workbooks?
There is a way! We’ll use the tried and true Superstore sample data to illustrate.
This data set includes some fields with recognized geographic roles such as City, State, and Postal Code (Zip), but it also includes a Region field that does not have a geographic role. Now, this is purely an example and this data set only has 4 regions — so it wouldn’t be too difficult to lookup latitudes and longitudes and plug them into Tableau like we saw last week.
(by the way, Shawn Wallwork got me to thinking and I realized you don’t need to leave Tableau and go to Google to find out the lat/lon for a coordinate on a map. Just right-click the map and add a point annotation then Include latitude and longitude to see where that point is.)
But what if you had ten regions? Or 15 territories? And what if you want to reuse the results in more than one workbook?
Well, the good thing is, Tableau is ready to help! We just have to coax it a little…
Get the Data Set with Latitudes and Longitudes
I’ll start by creating a geographic view that includes Region but also a few other geographic fields so Tableau will use the Latitude and Longitude fields it automatically generates:
Here I have a mark for each Postal Code (Zip code) color coded by Region. You’ll notice that Regions contain multiple zip codes and a single zip code is contained in only one region. This data is really clean — but this technique will work even if the data isn’t quite so nice. Just have some kind of geographic relationship.
Here’s the trick — we’re going to capture Tableau’s values for latitude and longitude — along with the associated Region and then create another data source with that data.
I press Ctrl + A to select all the marks on the map (or Area select them) and then right-click a mark and select “View Data”. And there it is, the data set I want!
Now I have every zip code within a region along with the associated Latitude and Longitude. Now, simply press Ctrl + A to select all rows, then Copy, then close the dialog box, then Ctrl + V to paste back into Tableau as a new data source!
And now, the magic:
Use Data Blending to use the Latitudes and Longitudes
We’ll start a new sheet with our original data set and put Region on the Marks card to define the level of detail. Then, we’ll switch to our new data source and bring out Latitude and Longitude to Rows and Columns. We’ll use an aggregation of AVG for both. Guess what? When we blend on Region, that’s the geographic center of all the zip codes within that Region!
And there you have it! You now have an easy way to plot marks for any number of regions or territories or unknown geographic field based on the geographic center of a known geographic fields.
Like it? Let me know in the comments and also check back next week for one more step that makes this even more exciting!
Tableau has outstanding built-in geocoding capabilities. If you have countries, states, zip codes, congressional districts, statistical areas, etc… in your data then Tableau knows where to plot marks on a map. But there are times when you have data that doesn’t match up with standard geographic locations. There are great tools and techniques out there for generating geocoded data or custom polygons. But over the next few weeks, I’m going to look at various simple techniques that work when you don’t have the time or resources to get too fancy or you simply just need to get the job done.
For example, let’s say you are working with an NGO in Papua New Guinea and want to track shipments of supplies to three different regions in the country. Your data looks like this:
No states or counties, etc… only Regions. And those won’t be recognized as anything geographic. Indeed, Region comes through as a text field and there are no automatically generated Latitude or Longitude fields:
But set the geographic role of the field (right-click Region and select Geographic Role > Area Code). We’ll use area code because there’s no possibility that our regions are valid area codes. Now we see Latitude (generated) and Longitude (generated) as new fields in the data window and double clicking Region gives us a Map!
Of course, Tableau lets us know via an Indicator that three of the area codes are “unknown.” Well, of course they are! But we can fix it… Just click the Indicator and then Edit Locations…
Then, just enter the latitude and longitude for your regions:
It’s a good thing you’ve memorized latitudes and longitudes for various locations in PNG!
Wait… you haven’t?
Oh. Well, you could always use Google Maps (or Bing). Just find a location that represents where you’d like your Region to be, right click and ask Google, “What’s Here?”
And Google will tell you (and give you the latitude and longitude, which you can select and copy/paste)
Repeat that a couple more times, plug the results into Tableau, and you can now plot your data exactly where you want it.
Touch it up with a little transparency, some borders, and notice the dual axis that let me plot text in the center of the circles. And there you have it! A simple technique to get things mapped where you want.
Now, you’ll ask, “What if I have a lot of things to plot and I don’t want to look up all the latitude/longitude values?” or “What if I want to use this in multiple workbooks and I don’t want to have to edit locations each time?”
Great questions… you’ll just have to check back next Tuesday for the next tip…
I recently blogged about my favorite Tableau 9.0 feature: LOD Calculations. This feature really blows open the possibilities for analysis and answering complex questions. But there are dozens of little features, enhancements and tweaks that might initially go un-noticed. And they make a huge difference in the look, feel, and overall experience. These are some of my favorites:
Go ahead and sing it (to the tune of “Raindrops on roses and whiskers on kittens…”) The guy in the next cubical won’t mind…
Responsive Tooltips: I remember seeing this feature proposed by Tim Wahl (http://community.tableausoftware.com/ideas/2643) and thinking it would be impressive. Well, the Tableau developers implemented the idea and it’s even more impressive in action. And they kept the option for using the old wait for hover. I love it when developers don’t assume new ways are always best in all circumstances. The Tableau engineers are the best!
Speed: Everything seems faster. The UI is more responsive, the startup time is shorter, parallel query processing dramatically speed up dashboards, and quite a few behind the scenes engine enhancements make for an overall pleasant experience. It feels like I’ve upgraded my computer hardware just by upgrading to Tableau 9.0.
Speed: Not only speed of the platform, but the speed of design is faster too. Need a reference line? You used to have to right-click an axis, select Add Reference Line, and then select your options. Now: switch to the Analytics Tab and you have drag and drop analytics! Need a quick calculation? You used to have to right click in the data window and select Create Calculation, write some code, click OK, find the new calculated field in the data window and then drop it into the view. Now: double click a blank space in Rows, Columns, or Marks and type some code to create an Ad-hoc calculation.
The new 9.0 calculation editor, which can stay open while you edit the view is an incredible feature too!
Home Screen: It looks sharp and polished. It is also slick and responsive. Thumbnails change sizes and you see more or less depending on the size of the window. It’s easy to quickly connect to data or open workbooks.
Data Connection: The new data connection menu is polished and sports a new search box (important when new types of connections are added with each new release! I remember when the Google Analytics connection was new…)
Data Preparation: We’ll soon be saying, “Remember when you had to use the Excel ad-in to reshape your data? (Oh, and sorry, Mac didn’t have it.)” No longer. Now the ability to pivot and reshape data from Excel is built-in. Throw in the new Data Interpreter which figures out excessive headers, footers, and merged cells, along with the ability to split fields and data structure issues become a lot more manageable.
Color Picker: Love the new design and especially the ability to pick a color on screen. Ever want to easily and exactly match your website colors for embedding a view? Now you can!
Sheet Preview: Ever forget whether you wanted to insert Sheet 18 or Sheet 19 in the dashboard? Hover over a sheet tab at the bottom or on the left side-bar when designing a dashboard or story and see a thumbnail preview.
Tableau Server: This one deserves its own blog post. I work with Desktop day by day it’s easy to overlook Tableau Server except when I want to share my work. But the developers have shown Server the respect it deserves. The interface is completely redesigned and the experience is very pleasant. You’ll especially love the update if you have to administer users, groups and permissions.