2 Replies Latest reply on Sep 15, 2018 4:54 AM by Jim Dehner

    Combined field vs Calculated field

    Roisha Pal

      Hi Guys,

       

      What is the difference between Combined column vs Calculated Column. Is there any disadvantage of using Combined column in Tableau? In my scenario I m combining two columns

      Col1 and col2 using + sign calculated  column str(col1) + str(col2) but in this case if col1 is 0 final data is showing 0. But with combined function its shows 0,col2. but i can not use combined column in a if expression. is there any other way we can correctly merge columns and use in if expression.

        • 1. Re: Combined field vs Calculated field
          swaroop.gantela

          Roisha,

           

          If you need to put the result in a calculated field, I think your will need to use the + method.

          It sounds like there are nulls in your data.

          If your columns are numerical, you can use

          STR(ZN([Col1Num]))+","+STR(ZN([Col2Num]))

           

          If your columns are text, you can use:

          IFNULL([Col1Str],"Null")+","+IFNULL([Col2Str],"Null")

           

          Please see workbook v10.3 attached in the Forum Thread.

          • 2. Re: Combined field vs Calculated field
            Jim Dehner

            Good morning -

            not certain I understand your issue

            the way you describe "Combined fields" sounds like you are concatenating 2 dimensions which are strings (text) and some of the data are nulls

            you want a concatenated text as the result and want to eliminate the 0 in col2 from nulls then   [col1]+ifnull([col2],null) should work

             

            if the data are numeric and you expect a numeric result then you would use sum(zn(col1)) + sum(zn(col2))  for example

             

             

            Jim

            If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.