ad

Taking Dashboards from Good to Great with Custom Color Palettes

Contributor & Author: Tiffany Spaulding
Reference: Click Here


Learning Tableau is like learning to write. We start with single letters, uppercase and lowercase before we ever build words, phrases, sentences, and paragraphs. If we focus on just the penmanship aspect, our handwriting has hopefully evolved from age 4 through now. As we evolve, we eventually develop our own style as we are exposed to alternative handwriting families: script, caps, technical, cursive, bubbly, architectural, and even the quick chicken-scratch every now and then. Through repetition, we develop and hone the skill over time. The same happens with our design style in Tableau, but instead of letters, we are learning functionality: chart types, calculated fields, filters, groups, sorts, hierarchies, and parameters.

Learning Focuses on Function:
As new users become more comfortable with Tableau, they tend to search for ways to make their dashboards stand out: testing new functionality, incorporating Jedi hacks, pushing the barriers of what was conceivable, and using other technologies to enhance Tableau. Some of the best dashboards in production utilize none of the former enhancements, just basic Tableau functionality plus a little something extra.

What Makes the Best Dashboards Different?
  • They are clean, simple, and intuitive. 
  • They don't fight Tableau but embrace its beauty. 
  • They require minimal training or orientation to use the dashboard successfully.
  • They encourage curiosity, discovery and action.
  • They balance form and function.
Great Design Respects Form and Function
The most used dashboards gracefully balance form and function. Designing minimalist dashboards takes hours and hours of effort to polish, re-evaluate, test, and redesign. Instead of simply knowing how to press buttons in Tableau, to become great in the tool, you'll need to embrace design principles such as proportion, balance, rhythm, and harmony. Knowing that most people who use Tableau have never taken a course in 2D or graphic design, I'll be sprinkling in a few posts here and there on graphic design basics and how to incorporate them into Tableau. Let's ease into our first topic: color.

Use Color Palettes That Strengthen the Data
A very simple modification you can make to any dashboard is to design the color palette relative to the story the data tells. If you are building a dashboard looking at football stats for the Houston Texans, you'd probably incorporate the Texans logo. To enhance the dashboard graphically, modify the color scheme to a Houston Texans palette. All of us have emotional ties to color. Why not utilize that emotion to strengthen the familiarity and connection of the dashboard with the end user? Intuitive color palettes increase speed of insight, giving your end user valuable time back in their day.

Step 1: Find Color Inspiration
Logos are great places to start building a color palette from, but websites and photos can work just as well. For kicks, let's pretend we are analyzing the popularity of M&Ms candy by color. We could get close by randomly choosing a yellow, green, red, blue, brown, and orange, or we could find a photo with all the colors shown and then extract the colors from the picture.

Step 2: Build the Palette
  1. If you are using Sample Superstore as your data source, drag any dimension with 6 members or more to the Color shelf on the Marks Card. I used Sub-Category and then aliased the members to the M&M colors.
  2. Using the drop down on the Marks Card, change your mark type to circle.
  3. Click the Size button on the Marks Card and move the slider all the way to the right to increase the circle sizes.
  4. Create a Calculated Field for the label. Formula = "M"
  5. Drag your new label field to Label on the Marks Card.
  6. Click the Label button on the Marks Card and adjust the formatting.
Font = White, 36pt, Bold
Alignment = Middle Center

Now that our base view is built, look closely at the legend: Blue is shown as Blue however Brown are shown as Orange. We need to edit our colors not only to ensure each color matches the name, but to the exact shade of each M&M hue.

To edit the colors, click the Color button on the Marks Card and select Edit Colors (or double click the color legend). We can reassign the color values by selecting any of the pre-built palettes from the drop down list in the top right corner of the pop-up menu. 
Side Note: In 8.x versions, this is where I would leave Tableau and utilize a color tool such as Pixie Color Picker to scrape the HTML color codes. I'd then write XML code to build a custom color palette in my Preferences file in the Tableau Repository. 
Version 9 gave us a new feature called the Color Picker to make creating ad-hoc custom palettes quicker and easier. To access the new tool, double click on the colored square for Blue in the left hand column of the pop-up menu ("Select Data Item:"). A new popup menu titled "Select Color" will appear.

  1. To begin building your palette, click one of the white rectangles in the bottom left corner under Custom colors. 
  2. Next click the "Pick Screen Color" button in the top left quadrant of the pop up menu.
  3. Click anywhere you want to pull the M&Ms blue color from. (Having dual monitors makes the process a little easier, but you can navigate to another program and it will read the next click.)
  4. Click "Add to Custom Colors" to save the color to your palette. 
  5. Press OK.
  6. Rinse and Repeat selecting the second data item in the list at the left of the Edit Colors menu. Work your way through all 6 colors.

Our original view of the M&Ms now match the exact colors of the candy coating, bringing familiarity and relativity to the data simply through color, shape, and label. 

Caution: Building color palettes through the Pick Screen Color option is designed for ad-hoc purposes. You are limited to 16 colors in your palette and it is only active in the existing workbook while it is open. Once you save and close the workbook, the Custom Colors will return to white rectangles once again. Any data points assigned to your custom colors will remain encoded. 

Step 3: Check the Palette for Color Deficient Viewers
Tableau has invested heavily in developing their color palettes to span the most users. Should you choose to develop your own, please use an app such as Vischeck to ensure your new custom color palette is friendly to color deficient viewers?

Step 4: Save Palette for Future Use

If you need to share color palettes or save them for use across multiple workbooks, check out this article on how to write XML code in your Preferences.tps file. If you would like Tableau developers to build in an option to save a Custom Colors palette from within the pop-up menu, please upvote this post in the Community.

Three Methods for Building a Bar in Bar Chart

Contributor & Author: Tiffany Spaulding
Reference: Click Here

Many users in the Tableau community depend on the “Show Me” menu to get them started down the path toward their goal visualization, however all too often “Show Me” provides something other than what you envisioned. “Show Me” is a wonderful way to enable new users in the tool to gain momentum, but I challenge you to think with the tool instead of guessing where it will end up.

A quick reminder as we dive in, the Columns and Rows shelves are what I term “Structural Shelves.” They determine orientation or position of headers, footers, and axes. Continuous fields (represented by green pills in view) will generate an axis when landed to a structural shelf. Discrete fields (represented by blue pills in view) will generate headers, footers, or buckets when landed to a structural shelf. They partition the data in view.

To assist with clarity of the instructions provided, italicized text denotes a specific mouse control while bold text denotes either a field or menu selection.

This week’s challenge: What are the possible methods to build a Bar in Bar chart? Let’s take a look at Sales versus Budget Sales in the Sample Coffee Chain data set.

Method # 1: Measure Names Measure Values (MNMV)

  1. Double click Product Type (loads to Rows shelf).
  2. Double click Product (loads to Rows shelf).
  3. Drag & drop Sales to Columns.
  4. For ease of viewing, I recommend expanding your view to fill the available space by adjusting the Fit (dropdown arrow next to "Normal" in the top toolbar) to "Entire View."
  5. Adjust the thickness of the bars to make them thinner by clicking the Size button on the Marks Card and shifting the slider to the left until it is at the tick mark.
  6. Drag & drop Budget Sales to the axis built by Sales at the bottom of the view. Measure Names Measure Values will automatically be triggered to view. Notice the axis title is now “Value” instead of Sales.
  7. Right click on the axis and select Edit Axis. In the title box, delete Value and replace it with “USD”.
  8. Move Measure Names from the Rows shelf to Color on the Marks Card.
  9. From the data window, drag & drop another instance of Measure Names to Size on the Marks Card.
  10. To unstack the marks, select Analysis > Stack Marks > Off in the top menu.

  11. Tableau defaults to loading the two fields in alphabetical order from thin to thick and front to back. To make Budget Sales the background or referenced field and Sales the dominant field, pick up Budget Sales from the Measure Names size legend and drag it beneath Sales. This reassigns which measure is thin and which is thick.
  12. Click the Color button on the marks card and select Edit Colors. Set Sales to blue and Budget Sales to gray.
  13. Depending on the colors selected, color deficient viewers may struggle to clearly see the difference between the two colors. For assistance, add a white border to the bars to define the edges by selecting the Color button from the Marks Card, and using the drop down menu for border to select white.
  14. Depending on the number of rows shown in view, the size proportions may need to be adjusted to suit your needs. To do so, right click on the size legend and select Edit Sizes.
Method # 2: Dual Axis Bar Chart
  1. Double click Product Type (loads to Rows shelf).
  2. Double click Product (loads to Rows shelf).
  3. Drag & drop Sales to Column.
  4. For ease of viewing, I recommend expanding your view to fill the available space by adjusting the Fit (dropdown arrow next to "Normal" in the top toolbar) to "Entire View."
  5. Load Budget Sales to the Columns shelf. Notice you now have 3 marks cards (the All marks card which is the one we always have, a marks card just for SUM (Sales), and a marks card just for SUM (Budget Sales). We will come back to these in step 7.
  6. Right click Budget Sales on the Columns shelf and select Dual Axis
  7. Tableau changes the automatic mark type from bars to circles. Don’t freak out, let’s change them back to bars. Ensure you are on the All marks card (All should be bold. If it isn’t click the word All until it becomes bold and the marks card appears beneath it). From the All marks card, use the drop down arrow next to the word Automatic to change the mark type to Bar. This will change the mark type associated with SUM (Sales) as well as SUM (Budget Sales). If only one mark type changed in view so you have bars and circles, you were not on the All marks card.
  8. By default on a dual axis chart, each axis maintains independent scaling. In our case, the unit of measure is the same and the quantities are proportional, therefore it is best practice to synchronize the scale of the two axes. Right click on the top axis for Budget Sales and select Synchronize Axis.
  9. With the axes synchronized, we do not need to show both axes. Right click on the top axis for Sales and uncheck Show Header (if you ever need it back and using CTRL+Z would undo far too much work, remember that axes are generated by green fields located on a structural shelf; right click on SUM (Sales) on Columns and select Show Header if you need to bring the axis back).
  10. The remaining axis no longer only represents Budget Sales. Right click on the bottom axis and select Edit Axis. Change the title of the axis to “USD”.
  11. Tableau has defaulted the layering of the marks from front to back based on the order of the measures loaded to the Columns shelf. To place Budget Sales as the background bar, switch the order of the two measures on Columns to read SUM (Budget Sales) and then SUM (Sales).
  12. To make the foreground bar thinner, select any one of the Sales bars to bring the SUM (Sales) marks card forward. From the marks card, click the Size button and move the slider to the left to the desired thickness.
  13. To add a border, from the SUM (Sales) marks card, select the Color button and use the dropdown for border to select white.
Method # 3: Bar Chart with Reference Line
  1. Double click Product Type (loads to Rows shelf).
  2. Double click Product (loads to Rows shelf).
  3. Drag & drop Sales to Columns.
  4. For ease of viewing, I recommend expanding your view to fill the available space by adjusting the Fit (dropdown arrow next to "Normal" in the top toolbar) to "Entire View."
  5. Adjust the thickness of the bars to make them thinner by clicking the Size button on the Marks Card and shifting the slider to the left until it is at the tick mark.
  6. To show Budget Sales as a reference line, we must load it into the temp table first. To do so, drag & drop an instance of Budget Sales to Detail on the marks card. Nothing will change in view but now we can call against the values to generate our reference lines.
  7. Right click on the Sales axis and select Add Reference Line. 
  8. In the pop up menu, keep the setting of a Line. 
  9. Change the Scope to Per Cell.
  10. Value should be SUM (Budget Sales).
  11. Label should be None.
  12. Format the Reference line to be a none with gray fill below. Click OK.
  13. Add a white border to the bars (Color button > Border > White).
  14. To add a white line in between every row, right click in the background white space of the bar chart and select Format.
  15. The format menu will overtake the data window. At the top are 5 buttons. Currently the menu is inside the Format Font menu which is the first button. Click the 4th button from the left to enter the Format Borders menu.
  16. Under Row Divider, change Pane to be a white semi-thick solid line. There is now a white line between every Pane.
  17. To place a white line between every Cell, adjust the Level slider to the right.
Depending on the structure of your data set or the custom formatting needed for your visualization, it might be easier to build through one method instead of another. My personal go-to is the dual axis method because the additional marks cards give greater power over formatting and labels. 
Bar in Bar charts allow for quick and accurate comparison across measures, letting your eye visually compare two metrics relative to each other without requiring much explanation or taking up more dashboard real estate. They are very useful to display Budget to Actual as in the examples provided here, but can be used for Year over Year comparisons. While it is possible to technically produce a “Bar in Bar in Bar…” chart in Tableau by landing a discrete field to Size on the marks card, I recommend only using two layers of bars. When in doubt, follow the KISS rule (Keep It Simple Sweetheart). Should you need to show Budget, Actual, and Forecast on the same viz, consider utilizing a Bar in Bar chart for Budget to Actual, then add a reference line to show Forecast.

Tableau Tuesday: Three Pro-Tips for Calculated Fields

Contributor & Author: Tiffany Spaulding
Reference: Click Here


Pro-Tip #1: Increase the Font Size in the Calculator Editor:
When we start writing calculations into Tableau Calculation editor window (Right click in data window --> Create Calculated Field), Tableau defaults to a font size around 10pt. The font size is sufficient as we design sitting close to our PC screen, however it appears small when we project in front of a larger audience. Have no fear; we can increase the font size. This was very intuitive in 8.1; however in versions 8.2 and 8.3, it became a bit more difficult if you didn't have a numeric keypad on your keyboard. Now, 9.0 brought back the intuitive options 8.1 had (high five to whatever developer at Tableau heard my plea!).

Tableau Desktop 8.1:
Option 1: Hold CTRL key and then roll the scroll wheel on your mouse.
Option 2: Hold CTRL key and then use [+] or [-] on 10 key pad.
Note: CTRL + [+] or [-] on a regular keyboard does not work.

Tableau Desktop 8.2 & 8.3:
The ability to utilize CTRL plus the scroll wheel was removed from 8.2 and 8.3. The only option to zoom in on the text is to utilize the CTRL key plus [+] and [-] from the num key pad. CTRL plus [-] on the regular keyboard will still decrease the font size, however if you try CTRL with [+], you'll end up with [=] in your code.

Tableau Desktop 9.0:
Option1: Hold CTRL key and then roll the scroll wheel on your mouse.
Option 2: Hold CTRL key and then use [+] or [-] on keyboard or on 10 key pad.

I go back and forth between all four versions each week depending on what version a client is using. To keep it easy, here is a cheat sheet to remember how to zoom in each version of the tool. 

Increasing Font in Calculation Editor in Tableau Desktop:
Version
Increase Font
Decrease Font
8.1
CTRL + Scroll forward
or
CTRL + [+]   <--Num keypad only
CTRL + Scroll backward
or
CTRL + [-]   <--Num keypad only
8.2
CTRL + [+]   <--Num keypad only
CTRL + [-]  
8.3
CTRL + [+]   <--Num keypad only
CTRL + [-]  
9.0
CTRL + Scroll forward
or
CTRL + [+]
CTRL + Scroll backward
or
CTRL + [-]

Pro-Tip #2: Annotate Your Calculation Code to Explain the Logic to Others:
As we design in Tableau Desktop, we become intimately familiar with the data set and logic behind each calculation. Eventually we share our work with others though. Pass on the logic you used to build each calculation by adding annotations inside the code of your calculation. Any line of code in the calc editor that begins with a // will appear in a faded teal font and not be considered when Tableau computes the calculation. You can annotate anywhere in the calc, including in line with other arguments in the code. To end the annotation, press return and you are back to normal coding.

Pro-Tip #3: Add Comments to the Field:
Each of the previous two Pro-Tips still require going into the Calculated Field Editor (right click on calculated field in data window --> Edit Calculated Field). To save time for both you and future editors of the workbook, you can copy the code of the calculation and paste it as a comment of the field. When you hover your mouse over the field in the data window, you'll be able to see the calculation logic and annotations without having to enter the calc editor.
To begin, open your calculated field and copy the code:
  1. Right click on the calculated field in the data window --> Edit Calculated Field.
  2. Highlight over the code.
  3. CTRL + C to copy the code.

Next, add the code as a comment to the field:
4. Right click on the calculated field in the data window --> Default Properties --> Comment.
5. CTRL + V to paste the formula into the Comment Editor.
6. Press OK to close the Comment Editor.
7. To check your work, hover your mouse over the calculated field in the data window. The comment should appear the same way a tooltip appears for a mark in view.

Take it one step further and clean up your code (remove //). You can even color encode the text to still pass on the logic of function, field, and parameter by coloring with blue, orange, and purple respectively. If you will be presenting to a larger room, I recommend increasing the font size as well.


Rapid Calculations with Drag & Drop in 9.0

Contributor & Author: Tiffany Spaulding
Reference: Click Here

Here's a flashback to Tableau Desktop 8.3 to jog your memory in terms of how different the experience of 9.0 is. To build formulas, we either typed the code manually or scrolled through lists and double clicked the items we wanted to use.  
                                                                                                                                   

Tableau 9: A Whole New World
The biggest feature in 9.0 that affects my design speed is the drag and drop enhancements in the new calculations window. Simple mouse clicks now minimize manually entered syntax. Instead of having to double-click specific fields from scrolling lists or meticulously type every character from memory, Tableau 9.0 converts your drag & drop actions into code.
Feature #1: Pills become code when pulled IN to the calc editor from the view or data window.

Feature #2: Code becomes pills when pulled OUT of calc editor into the view or data window.

Feature #3: is the element that I failed to realize (pure oversight) until about a month ago. Pieces of code can be highlighted in the calc window then pulled into view to test. I don't know why I assumed you had to take either a small piece of the formula or the whole shebang, but my efficiency is better now that I know. These new design features reflect Tableau's iterative approach to visualizing data, allowing you to compare outcomes as you think with the tool.
Notes:

  • Operators still need to be hard coded from the keyboard () [] {} + - / * < <= > >= <>.
  • Functions still need to be double clicked from the list at the right-hand side of the calc editor (or may be typed in from the keyboard).
  • If pulling an instance of a field from a shelf into the formula box, you do not need a CTRL + drag like some may think. Tableau leaves the original instance on the shelf and copies the code of the field into the calculation syntax. 
  • In my research to the limits of the drag and drop capabilities of the 9.0 calc editor, I discovered two limitations. First, the formula box will not receive Right Click drag (to select AVG Sales instead of Sum Sales) and second, the functions listed at the right of the formula box cannot be added via drag and drop.