6 Replies Latest reply on Nov 15, 2012 6:54 AM by Adel Nero

    using groups in calculations

    Adel Nero

      Is it possible to use a created group in a calculated field... I don't see it on the list of dimensions and parameters. Does anyone know a way of accomplishing this?

        • 1. Re: using groups in calculations
          Andy Piper

          Adel,

           

          Groups cannot be used for calculations. According to the Tableau 7.x help file "You can use the grouped field just like any other field in the view, except the grouped field cannot be used to create calculated fields."

           

          Through the use of sets or calculated fields, you may be able to achieve what you were trying to accomplish.

           

          Regards,


          Andy Piper

          • 2. Re: using groups in calculations
            Adel Nero

            Thanks for the reply Andy,

             

            What I am trying to accomplish is rolling up many subcategories of product into a handful of master categories.I want to use a parameter to allow the end user to choose what dimension they would like to see represented by color in a stacked bar chart. I have had no problem getting the other fields I needed in the drop down. I just need a way to get my "Master Categories" as an option because there are too many subcategories for the information to be useful.

             

            Any Ideas?

             

            Thanks

             

            Adel

            • 3. Re: using groups in calculations
              Andy Piper

              Adel,

               

              Consider creating a calculated field to create your "Master Categories".

               

              For example, lets say there are 7 categories in a field called "Category". Categories 1-3 are related and should be grouped, categories 4-6 are related and should be grouped, and category 7 is strong enough to stand on its own.

               

              The calculation for "Master Category" could look like:

              IF([Category]="Category 1" OR [Category]="Category 2" OR [Category]="Category 3") then "Category A"

              Else IF ([Category]="Category 4" OR [Category]="Category 5" OR [Category]="Category 6") then "Category B"

              Else "Category C"

              End End

               

              You could then use the field Master Category in a calculation. If you have difficulties with this, please let me know.

               

              Hope this helps,

               

              Andy

              • 4. Re: using groups in calculations
                Adel Nero

                I tried to write the calculation but I am getting an error "Expected "END" to match if at character 1596"

                 

                 

                If( [Category]="Casual & Athletic Shoes" OR [Category]="Designer Shoes & Accessories" OR[Category]="Jewelry" Or[Category]="M/W/C Apparel" OR [Category]="Watches") Then "Designer Goods"

                Else If ([Category]="Camera & Lenses" Or [Category]="Camera Accessories" Or [Category]="Car Audio & GPS" Or [Category]="Computer Software" Or [Category]="Computers" Or [Category] = "Digital Text Accessories" Or [Category]= "Digital Text Readers" Or [Category]="DVD's / Movies" Or[Category]="Electronic Components" Or [Category]="Electronics" Or [Category]="Mixed Electronics" Or [Category]="Mobile / Portable Electronics" Or [Category]="Music CD's" Or [Category]="TVs" Or [Category]="Video Games" Or [Category]="Wireless") Then "Electronics"

                Else If ([Category]="Furniture" Or [Category]="Hardware/Tool/General" Or [Category]="Home Essentials" Or [Category]="Home Improvement" Or [Category]="Home Products" Or [Category]="Homeware" Or [Category]="Kitchen & Cooking" Or [Category]="Kitchen Essentials" Or[Category]="Lawn & Garden Outdoors" Or [Category]="Lawn and Garden" Or [Category]="Major Appliances" Or[Category]="Plumbing & Accessories" Or [Category]="Tools") Then "Home and Garden"

                Else If ([Category]="Baby" Or [Category]="Toys") Then "Kids and Baby"

                Else If ([Category]="Automotive" Or [Category]="Books" Or [Category]="Food" Or [Category]="General Merchandise" Or [Category]="Industrial and Scientific" Or [Category]="Luggage" Or [Category]="Miscellaneous Product" Or [Category]="Musical Instruments" Or [Category]="Office Furniture and Accessories" Or [Category]="Pet Supplies") Then "MISC"

                Else If ([Category]="Beauty Products" Or [Category]="Health And Beauty Aids" Or [Category]="Personal Care Appliances") Then "Personal Care"

                Else If ([Category]="Outdoor Sporting" Or [Category]="Sports" Or [Category]="Sports & Toys") Then "Sporting Goods"

                End

                 

                Does that look like I am on the right track?

                 

                Thanks

                 

                Adel

                • 5. Re: using groups in calculations
                  Andy Piper

                  Adel,

                   

                  You are clearly on the right track. Make sure that for each "IF" statement in your formula you have an "END" statement that closes it. Therefore, at the bottom of the formula, you should have 7 "END"s.

                   

                  Andy

                  1 of 1 people found this helpful
                  • 6. Re: using groups in calculations
                    Adel Nero

                    Andy,

                     

                    Thanks for all your help! It works perfectly now.

                     

                    Adel