3 Replies Latest reply on Jun 28, 2018 10:07 AM by Joe Oppelt

    Create new column by summing different fields

    Tony Phan

      Hello,

       

      I am trying to add numbers from different columns depending on the criteria. This can be a new calculated field for a new column named "landing spot".

       

      If it is month 1, add recommit month 1 + recommit month 2 + recommit month 3

      if it is month 2 ,add SFDC Booked amount month 1 + recommit month 2 + recommit month 3

      if it is month 3 ,add SFDC Booked amount month 1 +  SFDC Booked amount month 2 + recommit month 3

       

      We are using Tableau version 10.5

        • 1. Re: Create new column by summing different fields
          Joe Oppelt

          You can use table calcs to add up strings of values from "here" to "there".

           

          In the attached on sheet 1 I added a calc called INDEX to show me what tableaus "sees" as the order of cells on the sheet.  (If I don't like the order of the numbers, for instance if the numbers increment down the sheet instead of across, I can edit the table calc to run in a different direction.)  Once I am happy with the ordering of the index numbers, I will want to set all the other table calcs to the same setting.


          As it turns out here, the default that Tableau picked is perfect for me.


          Go to sheet 2.

           

          Here I have a calc that does what you need.  See [Calculation1].

          • 2. Re: Create new column by summing different fields
            Tony Phan

            Thank you! One further question. I only want to show one month at a time. For example, I only want to show month 1 OR month 2 OR month 3. I can hide them in Tableau, but I am hoping to make this automated and not have to change it/ hide and unhide each month.

             

            Can we create a parameter or calc field or filter to only show one month at a time that a user can select? I created a tab called "one month" where I created a parameter, and when I select "month 2", the data disappears.

            • 3. Re: Create new column by summing different fields
              Joe Oppelt

              Can't filter with a quick filter because you need all the values in the table so the table calcs have access to them.

               

              But if you filter with a table calc, then that filter won't discard rows in the table.  It will just control what part of the table to display.

               

              Using LOOKUP as I did in the attached is a quick way to do a table calc filter.  Save this example somewhere.  It will come in handy for other such uses in other workbooks!

               

               

              It's a pretty cool technique, and the result is a filter that looks just like a quick filter to the user.