treemaps and table calculations: an exploration of colors, sorting and partitioning in tableau
DESCRIPTION
Treemaps and Table Calculations: An Exploration of Colors, Sorting and Partitioning in Tableau. Jonathan Drummey Quality Management Data Analyst Southern Maine Medical Center [email protected]. What You Will Learn. Making Sense of Non-Cartesian Layouts - PowerPoint PPT PresentationTRANSCRIPT
Treemaps and Table Calculations:An Exploration of Colors, Sorting
and Partitioning in Tableau
Jonathan DrummeyQuality Management Data Analyst
Southern Maine Medical [email protected]
West
South
East
Central
What You Will Learn
• Making Sense of Non-Cartesian Layouts• Putting Multiple Pills on the Color Shelf• How Tableau Builds Treemaps• A Lot About Sorting – And how to answer a Tableau brain teaser
• Basic Addressing and Partitioning• Using Restarting Every and At the Level
Non-Cartesian Layout• Mark stacking is on by default for most Mark Types
– Triggered by more in overall level of detail than displayed in the view• Requires no continuous (green) pills on Rows or Columns• Explicitly used by Treemaps, Packed Bubbles, and Word Clouds
• Signs that Mark Stacking is on:– Left aligned numbers and/or text with odd layout– Ellipses (…) indicate that there is more data in the cell than Tableau
can display– Big view area – fills the screen and potentially more than necessary
for the marks you can see
Multiple Discrete (blue) Pillson the Color Shelf• Top pill assigns categorical colors from the Tableau 20 palette• Least saturated color in each color range is always the same• All other pills create a “set” of the combined members within the color ranges
defined by the top pill• Colors are evenly distributed from darkest to lightest based on the # of members of
the “set”• Once created can be edited
– If that is done, new color values will also need to be manually set• Lose color highlighting if a discrete measure is part of the set of colors
• Three ways to turn this on:– Shift+Click and/or Ctrl+Click to select multiple pills from Data window and drag them onto
Color Shelf– Shift+Drag a pill to add it to the Color Shelf– Use the shelf type icon menu that is located next to the pill on the Marks Card to change to
Color
Color Assignment Issue #1: Dark to Light• Dimension pills on color – no problem, use pill sort.
• When a discrete measure is used on color, color ranges are assigned by either the alphanumeric or manual sort of the measure, with the first item getting order the darkest (most saturated) to the last getting the lightest (least saturated)
• Workaround is to use calculated fields that have the desired alphanumeric sort and use those on Color instead– If a less messy Color Legend is desired, use a separate worksheet
Color Legend w/hidden data or BYO Color Legend worksheet
Color Assignment Issue #2: Sorting• Dimension pills on color – need to set up sort before applying Color, or
reassign palette following sort.
• Discrete measure colors are assigned based on the alphanumeric sort of the “set” of discrete values
• Marks are positioned by the sort on the pills– setting a pill sort changes the order marks are displayed, not color
assignment
• Workaround is to use calculated fields that have the proper sort– Combined Fields, Build Your Own Combined Fields– String manipulations– Table calcs
Color Assignment Issue #3:Distribution
• Colors are evenly distributed based on the cardinality of the “set”
• Not the value of the item
• Workarounds are:– Do some sort of binning (if data is dense enough) – Manually set colors– Not use categorical colors and instead use
continuous pill on Color
Treemap Layout
• Non-Cartesian chart– Tableau totally determines layout
• A grouping level per dimension on Level of Detail• In each grouping level, largest mark or subgroup
in upper left, smallest mark or subgroup in lower right
• Sized and ordered by the pill on the Size Shelf• Won’t overlap labels
Dimension Pill Sorts• Alphanumeric• Manual• by Measure
What Kinds of Sorts are Usedin Tableau and Where
Pill Typesand
Arrangements
Color & Size Assignment
Legend Ordering
Mark Layout
TreemapLayout
Table CalcComputation
AdvancedCompute
Using
Top NFilters
Top N Sort
HierarchicalSort
Advanced…Field Sort
Measure Pill Sorts
• Alphanumeric • Manual
Column 1
Sort
Column 2
Value A
Sort
Value B
…Value N
SortSort
And so on for eachadditional Column…
Hierarchical Sorting
Tableau’s Sorting
Column 1
Sort
Column 2
Sort
Column 3
SortData
View
Hierarchical Sorting in Tableau
Column 1
Sort
Column 2 Column 3
Data
View
Column 1+2
Sort
Column 1+2+3
Sort
All Other Dimensions
in the View*
Addressing (Compute Using) and Partitioning: Choosing 1 Dimension
Partitioning
*Discrete (blue pill) regular aggregate Measures that have unchecked Ignore in Table Calculations automatically become part of partitioning.
Compute a result for each distinct address, i.e. each value of the chosen dimension
Restart the computation for any new value of the remaining Dimensions
Chosen Dimension
Addressing
Dimension 1Dimension 2
Addressing and Partitioning:Advanced Compute Using & Sort
PartitioningDimension 3Dimension 4Dimension 5Dimension 6
Addressing
Two sort options:• Automatic: Use the pill sort from the view (e.g. get a hierarchical sort)• Field: Sort the “set” of addressing dimensions by the chosen field
Dimension 1Dimension 2
Addressing and Partitioning:Restarting Every
PartitioningDimension 3Dimension 4Dimension 5Dimension 6
Addressing
Restarting Every keeps the sort defined by the table calc, and addsthe chosen dimension and all dimensions above it to the partitioning.
West
South
East
Central
Dimension 1Dimension 2
Addressing and Partitioning:At the Level
PartitioningDimension 3Dimension 4Dimension 5Dimension 6
Addressing
At the Level keeps the sort defined by the table calc, and increments the chosen dimension on it’s position within the partition, while dimensions below that don’t cause incrementing of ordinal table calcs like INDEX()
Know your data
Know your goal
Figure out how what shape the data needs to be in (given your knowledge of Tableau)
Set up the data and computations
Build the view
Review
• Covered a lot of ground but…– 3 minutes to build the entire view from connecting to data
to done (on a bumpy bus ride)
• Treemaps and Non-Cartesian Layouts• Putting Multiple Pills on the Color Shelf• A Lot About Sorting • Intro to Table Calculations– YMMV (Your Mileage May Vary) disclaimer about factors
affecting table calculation results
Thanks!
Jonathan DrummeyQuality Management Data Analyst
Southern Maine Medical [email protected]
http://drawingwithnumbers.artisart.org