KNOWLEDGE BASE

Creating Error Bars


Published: 22 Apr 2014
Last Modified Date: 12 Dec 2017

Question

How to create error bars in Tableau Desktop.

Environment

Tableau Desktop

Answer

The following instructions can be reviewed in the attached workbook.

Build the View

  1. Drag AVG(Sales) to the Rows shelf (The aggregation may need to be changed from SUM by right clicking Sales on the Rows shelf > Measure(sum) > Average)
  2. Right click and drag Order Date to the Columns Shelf.
  3. Select MONTH(Order Date) from the bottom of the list
  4. Change the mark type to Square from the drop down menu on the Marks Card

Create the necessary Calculated Fields

  1. Create a calculated field called Sales SE with the calculation: STDEV([Sales])/SQRT(COUNT([Sales]))
  2. Create a calculated field called Sales Error Bar (Bottom) with the calculation: AVG([Sales])-([Sales SE])
  3. Create a calculated field called Sales Error Bar (Top) with the calculation: AVG([Sales])+([Sales SE])
  4. Create a calculated field called Sales Error Bar (Length) with the calculation: [Sales Error Bar (Top)]-[Sales Error Bar (Bottom)]

Create the Error Bars

  1. Drag Sales Error Bar (Bottom) onto the Rows shelf next to AVG(Sales)
  2. Select the AGG(Sales Error Bar (Bottom)) measure on the Marks card and change the mark type to Gantt Bar
  3. Drag Sales Error Bar (Length) onto Size on the Marks Card for the AGG(Sales Error Bar (Bottom)) mark
  4. Right click AGG(Sales Error Bar (Bottom)) on the Rows shelf and select Dual Axis
  5. Right click the Sales Error Bar (Bottom) axis on the right side of the view and select Move Marks to Back
  6. Right click the Sales Error Bar (Bottom) axis on the right side of the view again and select Synchronize Axis.
More designs examples are available in the attached workbook Creating Error Bars.tbwx.

Additional Information

To view the above steps in action, see the video below. 
Note: The video has no sound.
Did this article resolve the issue?