240 likes | 424 Views
Treemaps and Table Calculations: An Exploration of Colors, Sorting and Partitioning in Tableau. Jonathan Drummey Quality Management Data Analyst Southern Maine Medical Center jonathan.drummey@gmail.com. What You Will Learn. Making Sense of Non-Cartesian Layouts
E N D
Treemaps and Table Calculations:An Exploration of Colors, Sorting and Partitioning in Tableau Jonathan Drummey Quality Management Data Analyst Southern Maine Medical Center jonathan.drummey@gmail.com
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” • Notthe 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
What Kinds of Sorts are Usedin Tableau and Where Top N Filters PillTypes and Arrangements Top N Sort Advanced Compute Using • Dimension • Pill Sorts • Alphanumeric • Manual • by Measure • Measure • Pill Sorts • Alphanumeric • Manual Hierarchical Sort Advanced… Field Sort Table Calc Computation Treemap Layout Color & Size Assignment Legend Ordering Mark Layout
Hierarchical Sorting Column 1 Column 2 Value A Sort And so on for each additional Column… Sort Value B Sort …Value N Sort
Tableau’s Sorting Data Column 1 Column 2 Column 3 Sort Sort Sort View
Hierarchical Sorting in Tableau Data Column 1 Column 2 Column 3 Column 1+2+3 Column 1+2 Sort Sort Sort View
Addressing (Compute Using) and Partitioning: Choosing 1 Dimension Partitioning Addressing All Other Dimensions in the View* Chosen Dimension Restart the computation for any new value of the remaining Dimensions Compute a result for each distinct address, i.e. each value of the chosen dimension *Discrete (blue pill) regular aggregate Measures that have unchecked Ignore in Table Calculations automatically become part of partitioning.
Addressing and Partitioning:Advanced Compute Using & Sort Partitioning Addressing Dimension 1 Dimension 2 Dimension 3 Dimension 4 Dimension 5 Dimension 6 • 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
Addressing and Partitioning:Restarting Every Partitioning Addressing Dimension 1 Dimension 2 Dimension 3 Dimension 4 Dimension 5 Dimension 6 Restarting Every keeps the sort defined by the table calc, and adds the chosen dimension and all dimensions above it to the partitioning.
Addressing and Partitioning:At the Level Partitioning Addressing Dimension 1 Dimension 2 Dimension 3 Dimension 4 Dimension 5 Dimension 6 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 Drummey Quality Management Data Analyst Southern Maine Medical Center jonathan.drummey@gmail.com http://drawingwithnumbers.artisart.org