4 Replies Latest reply on Jul 20, 2016 8:21 AM by Gurpreet Singh Goraya

    Calculation helps

    Gurpreet Singh Goraya

      Hello Tableau Forum,

       

      I already have asked the same question in the past. My problem is to count the same values in two different categories. I have created the calculated  field with "Contains" but no luck. Here is the screenshot of my sheet.

       

      I want all values with CL1 in Category 1 and ESC1 in Category 2 and MA1 in category 3. The result I expect of Column 1 is

      CL1 = 1150

      ESC1=84

      MA1=143

      Grand total =1377

      Here is the screenshot of calculated field

      Please advise. I would appreciate the help. Thanks

      Goraya

        • 1. Re: Calculation helps
          Nicholas Hara

          Hi Gurpreet!

           

          There are several ways you could tackle this. The best way also takes the most work, and requires some data prep. Another way is to create several calculated fields and get the count for each. I don't have a ton of time to go into depth right now, but if you send a sample workbook I might be able to take a look.

           

          Data Prep:

          1. Split the field in the Data Source Tab (right-click on the field and select Split)

          2. Export all the underlying data

          3. Connect to the exported data

          4. Pivot the NEW data

          5. Count the instances

           

          Calc Option:

          1. Create a Calculation for CL1 called Client: COUNT(CONTAINS([PASSON],"CL1"))

          2. Repeat for each category

          3. Use Measure Names and Measure Values to build your view as desired.

          • 2. Re: Calculation helps
            Gurpreet Singh Goraya

            @Nicholas Hara, thank you for the reply. I am getting data from oracle database and I am not aware how to split data process. I can provide you the data spreadsheet if you still required. I will try using count function in calculation. Thank you again.

             

            Goraya

            • 3. Re: Calculation helps
              Mark Fraser

              Hi Gurpreet

              I am getting data from oracle database and I am not aware how to split data process.

              You had me wondering if its possible to use Split functionality with Oracle, just tried, and it works fine.

              When you first connect to the data, on the required field, press the drop down arrow, as highlighted below

              Cheers

              Mark

              • 4. Re: Calculation helps
                Gurpreet Singh Goraya

                Thank you Mark.