Skip to content

Instantly share code, notes, and snippets.

@tommct tommct/README.md
Last active Aug 24, 2016

Embed
What would you like to do?
Tableau Box Plots and Histograms

This is a recipe for making box plots overlaying histograms in Tableau version 9.3. It largely borrows from http://vizpainter.com/some-tableau-tips-options-for-box-and-whisker/ and http://vizdiff.blogspot.com/2015/11/overlaying-histogram-with-box-and.html.

  1. Create a fixed continuous variable for number of objects per dimension. For example, the number of unique assignments per user:

     [Assignments Per User] = {FIXED [Userid] : COUNTD([Assignmentid])}
    
  2. Set the variable's Default Aggregation to COUNT.

  3. Drag the variable from Measures to the columns shelf.

  4. Set it to "Dimension" instead of CNT().

  5. Drag the variable again from Measures to the rows shelf keeping the CNT().

  6. Set the marks to Bar.

  7. In the Columns shelf, command-drag the variable onto the Columns shelf to duplicate it.

  8. Make it a dual axis.

  9. In the right column, "Edit in shelf" adding " * 1" so that it is "[<varname>] * 1".

  10. Select the middle Marks pane, the one that is named "[<varname>]".

  11. From the Data tab, select the dimension (e.g., UserId) that was used in the calculated field and drag it to the Detail mark in the middle pane. This fixes the box plot by adding a new one the way we want.

  12. Click the Analytics tab in the upper left of the screen.

  13. Drag a Box Plot to the screen, selecting <varname> (not "Cell" or "CNT(Varname)" or "[<varname>] * 1").

  14. Choose the top X-axis and turn it off by CTRL-clicking the axis and unchecking "Show Header".

  15. In the "[<Varname>] * 1" Marks panel, change the tooltip to "<CNT(Varname)> users with <[<varname>] * 1>" assignments.

  16. Change the Y-Axis title to "Number of <dimension>" (e.g. "Users").

Instead of the histogram, as an alternative, to have the size of marks indicate the height of the bars, drag the CNT(variable) from the Rows shelf to the Size shelf under the All Marks and change the mark to a Circle instead of Bar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.