Tableau

From Colettapedia
Jump to navigation Jump to search

GGplot to Tableau concept mapping

  1. Data Frame -> Data Source
  2. Aesthetic Mappings (aes) -> Shelves
    1. GGplot2: You use aesthetic mappings (aes) to map variables in your data to visual properties of the plot (e.g., x, y, color, size).
    2. Tableau: You drag fields to different shelves (Rows, Columns, Color, Size, etc.) to encode your data with visual properties.
  3. Geoms -> Marks
    1. GGplot You add layers to your plot using geoms (geom_point, geom_line, etc.) to define the type of visualization.
    2. Tableau: You choose a mark type (Bar, Line, Circle, etc.) from the Marks card to define the type of visualization.
  4. Facets -> Rows/Columns or Dashboard
    1. GGplot2: You use facets (facet_wrap, facet_grid) to create small multiples.
    2. Tableau: You can use Rows and Columns for small multiples, or create separate sheets and arrange them in a dashboard.


Create Tableau Data Source

  • Load data, then drag source to the "canvas"
  • Undo is back button at top left or Cmd-Z, try not to swipe left because that's back.
  • Below canvas is data grid
  • Tableau automatically infers data type
  • When you drag another data source there, the "Edit Relationships" dialog appears
    • Relationships dynamically adjust the SQL join type, hover over "noodle" to see summary of relationship
  • Click on Sheet1 to proceed

Workspace

Data Pane

  • Visualizations are created inside workbooks
  • Data Pane in sidebar displays all fields from the data source
  • Fields are grouped by data source table
  • Fields above divider are called "dimensions" - qualitative or descriptive data such as names, dates, geographic data, id fields,
  • Fields below divider are called "measures" - numeric, quantitative values that can be aggregated using functions such as sum and average
  • Dimensions control the level of aggregation of measures in a visualization.
  • Dimensions can be ordered into hierarchies.
  • Add dimensions to hierarchy using context menu or drag and drop into existing hierarchies, or create one.
  • You can hide fields yo don't plan to use, unhide at search-level menu
  • Across all tables, group fields by folder and then create folders to organize them.
  • Drag fields from the shelves and cards to build each visualization

Workspace "View"

  • Displays show up in largest part of workspace called "the view"
  • Build one visualization per sheet
  • Add additional sheets at bottom of workspace
    • You can edit worksheet title to make it different than the worksheet name.
  • Combine sheets to create dashboards and stories
  • Rename sheet at bottom just like Excel
  • Calculated field has bracket syntax, e.g., sum([Profit])/sum([Sales]), has equal sign next to their icon in data pane
    • Calculated Field - Analysis -> Create Calculated Field, e.g. sum([Profit])/COUNTD([Order ID]) (Countd is count distinct)
  • Multi-select fields and click "Show Me" to see a list of possible visualizations.
  • Visualizations should have hover-over to reveal tooltip, change what shows up by using "Marks" card; legend highlighting too.
  • Set number of color bins and bin extreme edges in Edit colors -> Stepped color. Legend will reflect color settings

Shelf

  • shelf = any of the areas where you can drag fields to affect your visualization
  • Types of Shelves in Tableau:
    • Columns Shelf: When you place a field on the Columns Shelf, Tableau creates headers for each value in the field along the x-axis. If you place a continuous field (like a date or a number) on the Columns Shelf, Tableau creates an axis.
    • Rows Shelf: Similar to the Columns Shelf, but it creates headers or axes along the y-axis.
    • Filters Shelf: When you place a field on the Filters Shelf, you can set conditions to include or exclude specific data points from the visualization.
    • Marks Card: EQUIVALENT OF AESTHETICS IN GGPLOT. While not a shelf in the strictest sense, the Marks Card allows you to control the visual encoding of your data, such as the type of mark (bar, line, circle, etc.), color, size, detail, and tooltip. You drag fields onto different parts of the Marks Card to encode your data with those visual variables.
    • Pages Shelf: Placing a field on the Pages Shelf lets you create a series of pages, each displaying a subset of the data. This can be useful for showing how a visualization changes over time or across categories.
  • Drag fields to the filter shelf a.k.a. card. Right click on the field in the filter and mark "Show filter" to make interactive. Then filter legend has properties which you can use to control appearance. Any field that is being actively used can have a show filter to make an interactive widget based on that variable.
  • Drag fields on top of one of the marks in the Marks card to add that fields representation to the view represented by that mark, i.e., Color, Label, Detail, tooltip.
  • Add facet by dragging category to the rows/column shelf
  • Add variable to the tooltip by dragging and dropping onto the tooltop marker card
  • Tooltip markup language uses angle brackets to reference fields:
Order Profitable?:     <Order Profitable?>
Category:     <Category>
Month of Order Date:     <MONTH(Order Date)>
Profit:     <SUM(Profit)>
Sales:     <SUM(Sales)>

Date Fields

  • Date fields when on an axis - you can select a date part (e.g., All Q1's), a date window value, e.g., Q1 2015 - Q4 2021, or exact date. BAsicvally an aggregation function.
  • Checking discrete fields in date field context menu will create their own tick marks/headers on x axis for each value (e.g. each month), continuous will not
  • Discrete fields are colored blue around the UI
  • Continuous fields are colored green, they create "axes" in the traditional sense
  • Keep date fields as continuous to ensure chronological order
  • highlight whole axis UI object in view to enable preferences - change range, scale (e.g., log scale), tickmarks, title,

Level of Detail Calculation

  • allows you to perform computations at a level of granularity that is different from the view being displayed
  • Almost like a group by or a random effect
  • Select dimension and a measure to create a LOC Calculation
  • C++ style comment in expression window
  • Three types:
    • FIXED: {FIXED [dimension1], [dimension2],... : aggregate(expression)} - It computes the value of the aggregate expression at the level of detail specified by one or more dimensions, regardless of the dimensions present in the view.
      • Example: { FIXED [Order ID]: SUM([Profit]) } > 0
    • INCLUDE: {INCLUDE [dimension1], [dimension2],... : aggregate(expression)}. It computes the value of the aggregate expression at the level of detail of the view, including any additional dimensions specified.
    • EXCLUDE: {EXCLUDE [dimension1], [dimension2],... : aggregate(expression)}. It computes the value of the aggregate expression at the level of detail of the view, excluding any dimensions specified.
  • Edit alias to change the label of LOD members
  • Set/change default sort order

Text table (Crosstabs/Pivot table)

  • "Text" widget on Marks card is how you make tables
  • "Measure Names" and "Measure Values" are two special fields in Tableau that enable users to work with multiple measures simultaneously in a single view.
  • "Measure Names" is a "dimension" that contains the names of all the measures in your data source.
    • When you drag "Measure Names" to a shelf, you can then include multiple measures in your view. Each measure will be listed as a member of the "Measure Names" field. This is useful when you want to create a table or chart that includes several measures.
    • It creates a new "Measure Values" card that allows you to edit the fields and agg functions used in measure names UI element. Change order of measures within card, and format each measure.
  • Put measure names on row or column shelf, and then the breakdown variable on the opposite shelf.

Fancy Tooltips

  • You can have subfigures (individual Tableau "sheets" short for "worksheets") appear inside hovering tooltips
  • Disable tooltip in figure which will be inserted, and turn off column headers
  • TBD: How to show only highest and lowest outlier values in barplot
    • Probably filter by head( absolute value )

Build a dashboard

  • Building a dashboard
  • Add horizontal and vertical layout UI elements, and then add dashboard elements within them
  • Layout pane shows object hierarchy
  • Add dynamic text to titles using angular bracket notation.

Best Practice

Content

  1. Have a clear purpose - what are you trying to say?
  2. Who are your intended audience
    • is subject matter familiar to them or new?
  3. Upper left corner of the dashboard is most important
    • Which visualization conveys the key message - put it in the upper left

Form

  1. Author at your final display size
  2. Limit number of views to 2 or 3, or else Tableau performance starts to choke
  3. Show filters
  4. Enable highlighting

Links


Tableau Prep

  • Use R and Python in your flow