Chapter 18. 3 Ways to Make Handsome Highlight Tables: Tip 3

Color Cells Based on a Discrete Segmentation

Two colors will not be enough for every objective. The two colors used in the previous tip provide more value than a plain-text table can alone, but this approach would be most useful if you were able to color the cells based on a performance segmentation of your choosing. For example, perhaps you have a goal for each sub-category or want to compare each value to the performance during a different period. For illustration purposes, let’s assume that we want to color the cells red if profit is negative, blue if profit is above our goal of $10,000, and gray for every remaining value.

To get this effect on other chart types, you would start by setting up a calculated field like this:

IF SUM([Profit]) >= 10000 THEN "Goal Met"
ELSEIF SUM([Profit]) < 0 THEN "Negative Profitability"
ELSE "Other"
END
Image
Image

But let’s see what happens when we continue building on the highlight table that we worked on in Chapters 16 and 17 and replace the Profit measure on Color Marks Card with our newly created Profit Segmentation calculated field:

Image

This is happening because we are now encoding the ...

Get Innovative Tableau now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.