# Sets based on second Dimension selection

Version 2

Description:

Originally created for Community Post: Re: Comparing within a Dimension

Create a set of one Dimension based on criteria from a second dimension.  For instance, the Products purchased when a State = "Rhode Island".

In addition,  this workbook shows how to create a combined set reflecting the Products sold in State 1 and State 2 exclusively.   Parameters may be utilized to select State 1 and State 2 as shown on the final example page of the workbook.

Screenshot:

Tableau Version: 8.3

Original AuthorPatrick A Van Der Hyde

Details:

In the attached workbook, two sets have been created. One set for [Products] purchased in the State of Rhode Island and another set of [Products] for California purchases.  Then we can utilize the Tableau "Combined Sets" functionality to show the members that exist in both States.

To recreate this workbook, select the Products Dimension and right click on the field.  From the drop down menu that appears, select "Create Set".

Next, select the tab "Condition" and in the "By formula:" section add this condition:

Max(iif([State] = "California",1,0))=1

This condition will result in a set where only the Products returned were sold in the State of California.  This is a pretty big list and we can see this list in the workbook and it contains 661 Products.

Next, duplicate the set creation process for Rhode Island.  This will return 20 products as seen in the Rhode Island view in the attached workbook.

Finally, select both sets from the "Sets" shelf by holding down the Shift key when selecting.  A pop up menu will appear that has the option to "Create Combined Set".  Up will pop a list of options in a Venn Diagram model that allows the selection of the intersecting Products from both views.  This combined set includes 11 products as seen on the final view.

To make things more interesting, I suggest altering the comparison to a Parameter containing a list of States.  I have created sample utilizing Parameter selections as well in the attached workbook.

I hope this helps you and others.  In addition, I suggest reviewing the great presentation from Bethany Lyons for our a recent Think Data Thursday here: Think Data Thursday - Let’s talk about sets, baby! - 11_20_2014

with the related group post here Think Data Thursday - November 20 - Let's talk about Sets Baby!

I utilize the examples provided by Bethany in her presentation in the attached workbook.