KNOWLEDGE BASE

Building a Venn Diagram


Published: 07 Aug 2014
Last Modified Date: 20 Dec 2016

Question

How to build a Venn diagram.

Environment

Tableau Desktop

Answer

The following instructions can be reviewed in the workbook attached below.

Step 1. Create the Sets

  1. Right-click on Container and select Create Set....
  2. Select "Jumbo Drum" and name the set Jumbo Drum.
  3. Repeat these steps for "Jumbo Box".

Step 2. Create a combined set of "Jumbo Box and Jumbo Drum"

  1. Right-click on Customer and select Create Set....
  2. Select the Condition tab and enter in the formula bar:
    SUM(IF [Container]="Jumbo Drum" THEN 1 END) >0
    AND
    SUM(IF [Container]="Jumbo Box" THEN 1 END) >0

Step 3. Create calculated fields

  1. Navigate to Analysis > Create Calculated field.
  2. Name the field "Outer Venn Position".
  3. Enter the formula:
    COUNTD(IF [Jumbo Box] THEN [Customer] END)
  4. Navigate to Analysis > Create Calculated field.
  5. Name the field "Overlapping Position".
  6. Enter the formula: [Outer Venn Position]/2
  7. Create a Calculated field and name it "Drum and Box Customers".
  8. Enter the formula: COUNTD(IF [Jumbo Box and Jumbo Drum]=TRUE THEN [Customer] END)

Step 4. Create the view

  1. Drag Number of Records to the Rows Shelf; change the aggregation to Minimum.
  2. Drag Outer Venn Position to the Columns Shelf.
  3. Drag Overlapping Position to the Columns Shelf.
  4. Right-click on Overlapping Position and select Dual Axis.
  5. Right-click on the Overlapping Position axis in the view and select Edit Axis > untick "Include zero" > OK.
  6. On the marks card for All measures: drag Container to Color 
    1. In the color Container, select Jumbo Drum and Jumbo Box (hold CTRL while clicking on both) and select Keep only.
    2. Right-click and drag Customer to Size and select CNTD(Customer)
    3. Right-click and drag Customer to Label and select CNTD(Customer)
  7. On the marks card for Overlapping Position: change mark type to Text
    1. Remove Container from Color
    2. Remove CNTD(Customer) from Size
    3. Remove CNTD(Customer) from Text.
    4. Drag "Drum and Box Customers" to Text
  8. On the marks card for Outer Venn Position:
    1. Change the mark type to Circle
    2. Change the color transparency to (75%) and add a black border
    3. Increase the Size of the marks to maximum and downsize the Outer Venn Position axis until circles are overlapping. (to 275)
      1. "275" on the axis is specific to this Superstore example. More information can be found in this community thread
  9. Right-click on the fields in the columns and rows shelves and clear the selection of Show Header
  10. Click on Format, select Lines, and remove Grid and Zero lines; select the Borders icon and turn off row and column dividers for pane.
  11. Optional: On the Overlapping Position marks card, increase the text size and change the text color to black.
Did this article resolve the issue?