1 Reply Latest reply on Feb 4, 2015 2:45 PM by Patrick Van Der Hyde

    Comparing within a Dimension


      Hi All,


      Using the Superstore data, I'm wondering if there is a way to compare Category items between two States using a calculated field. In other words, is it possible to automate the process of looking at only shared items between two different types of the same dimension? (i.e finding ONLY the category items that were bought in both Rhode Island and California to analyze say, total profits.) I'm hoping there is some way to develop a calculated field that combs through the columns and picks up only the items that both states share.


      Any thoughts would be much appreciated!

        • 1. Re: Comparing within a Dimension
          Patrick Van Der Hyde

          Hello kristen.ko,


          Welcome to the Tableau forums.  Without a sample workbook demonstrating more specific examples, I can only provide a example from Superstore sample data.  Attached is a workbook showing one potential solution.


          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.