2 Replies Latest reply on Jan 4, 2017 12:28 PM by Norbert Maijoor

    Nulls being removed by a Calculated Field

    Brian Green

      I have a simple calculated field (shown below) and I realized that it was removing null values, which I need to keep. For example, if Applicability is <= 2 and Content is a 4, but Delivery is null I want that record to be pulled in and currently it would be excluded. I need it to say if it's a null show the null and if it's a number then apply the below calculation. Please let me know if you need additional information. Thank you.

       

       

       

      IF      [Applicability]  <=2 

        THEN "Below Threshold"

      ELSEIF  [Content]        <=2

        THEN "Below Threshold"

      ELSEIF [Delivery]        <=2

        THEN "Below Threshold"

      ELSE "Above Threshold"

      END

        • 1. Re: Nulls being removed by a Calculated Field
          Sarah Ebreo

          Hi Brian,

           

          Does the following calculation work?

           

          IF ISNULL([Delivery]) THEN "Null" ELSE

                         IF [Applicability]  <=2

                           THEN "Below Threshold"

                         ELSEIF  [Content]        <=2

                           THEN "Below Threshold"

                         ELSEIF [Delivery]        <=2

                           THEN "Below Threshold"

                         ELSE "Above Threshold"

                         END

          END

           

          If not, can you provide a sample packaged workbook along mock-up of the desired behavior? If you provide a workbook, please also include the version of Tableau it was created in.

           

          Best,
          Sarah

          • 2. Re: Nulls being removed by a Calculated Field
            Norbert Maijoor

            Hi Brian,

             

            Find my approach as reference below and stored in attached workbook version 9.3

             

            Calculation:

             

            if [Applicability]<=2 or ISNULL([Applicability])=TRUE then "Below Threshold"

            elseif [Content]<=2 or ISNULL([Content])=TRUE then "Below Threshold"

            elseif [Delivery]<=2 or ISNULL([Delivery])=TRUE then "Below Threshold"

            else "Above Threshold" END