7 Replies Latest reply on Dec 2, 2013 11:04 AM by alex macharia

    Custom grouping

    alex macharia

      Hi,

      I need to create custom groups for different dimensions that are critical for business purposes.

      For example, I have a country dimension which as a list of all the countries. I would like to group countries in different groups, BUT some may need to be in multiple groups i.e. there is overlap

       

      Dimension

      • US
      • UK
      • CA
      • AUS
      • SWE
      • Other countries

       
      Here are the custom groups I would like to have the ability to create 
      Custom groups

      • US = United States
      • UK + SWE + CA + AUS = International
      • US + CA = America
      • US + UK + SWE + CA + AUS + Other countries = Worldwide

       

      Tableau shortcomings:

      'Create Group..'  only allows 1 dimension value per group i.e. dimension values such as US CANNOT be in the United States group and also in the America group.

      Calculated field..' In SQL I can do a case statement that would work fine but I can't use this in the calculated field. In tableau I need to use the IF ELSEIF--this method mutually excludes values.

       

      How can I create custom groups whereby a dimension value can be in multiple groups WITHOUT mutually excluding values

        • 1. Re: Custom grouping
          . Indumon

          Hi Alex, You can use case statement in Tableau calculated field.

          Due to the country overlapping scenario, I think you have to create 4 calculated fields to make your custom groupings in Tableau.

           

          Example:

          Unitedstates Group=

          Case [Country] When 'US' Then 'United States'

          Else 'Worldwide'

          End

           

          Custom Group.jpg

           

          Sample workbook attached.

          • 2. Re: Custom grouping
            alex macharia

            Hi, thanks for the prompt feedback.

            I need to have just one calculated field because I will use it in the page by so that the end user can select the different groups.

            Thanks,

            Alex

             

            Sent from my iPhone

            • 3. Re: Custom grouping
              . Indumon

              Hi, You can make it in a single calculated field dynamically, if you use a

              parameter to choose the group.

              Please find the attached sample

               

               

               

               

              On Sat, Oct 5, 2013 at 10:57 PM, alex macharia <

              • 4. Re: Custom grouping
                alex macharia

                Hi,

                I have been working more on this - I am trying to avoid having a geo group(Region). and just have groupings

                Ideally I would like groupings for US, AU, CA,UK,SWE, America, Wordwide, Other Countries

                When I try to create a parameter for this groupings and create a calculated field with a case statement I get duplicates?

                Any ideas on how to just have groups defined as  US, AU, CA,UK,SWE, America, Wordwide, Other Countries

                • 5. Re: Custom grouping
                  . Indumon

                  Can you share your calculation or sample packaged workbook?

                  • 6. Re: Custom grouping
                    Dan Huff

                    What you are asking for here is very difficult. Essentially, by having all of these groups in the view, you are asking Tableau to duplicate records. For example, you are asking for Canada to show up by itself, within the America group, and within the Worldwide group.

                     

                    The best way to accomplish this within editing your underlying data is to use multiple calculations and create a hierarchy so that your users can still select and drill up and down within the hierarchy.

                     

                    I hope this helps,

                     

                    Dan

                    • 7. Re: Custom grouping
                      alex macharia

                      Hey I figured it out,

                      I edited the case statement and it worked perfectly for groups that need to be shown individually and also overlap. e,g US and America which includes US and CA. The 'end' after each 'when' statement avoids exclusion.

                       

                      case [Choose grouping]

                      when 'America' then

                      if [Dim_Country_Description] = 'US' or [Dim_Country_Description] = 'CA'

                      then 'America'

                      end

                      when 'United States' then

                      if [Dim_Country_Description] = 'US'

                      then 'United States'

                      end

                       

                      I then linked this custom group to a parameter with America and United States as values and selected to show the parameter

                      I added the calculated filed to the filter and typed United States and and America in the custom value list.

                       

                      Thanks for your ideas folks