1 Reply Latest reply on Feb 17, 2016 10:26 AM by Nathan Panuco

    Or statement Question

    casey lee

      I have below function.

      Somehow, it's still counting the [Wo Status] ='Clos' and 'CANC' and 'Spay'

      Could you help me understanding where I'm missing and anyway to simplify the function?

      Thank you

        • 1. Re: Or statement Question
          Nathan Panuco

          Hi Casey!

           

          There are no syntax errors with the formula but I don't believe it is performing the action desired. Typically, an OR statement compares two values and returns true or false...it is not a method of traversing a decision tree.

           

          For example, if I had three color variables called RED BLUE and GREEN and wanted to return True if someone picked red or green, the formula would look like this:

          IF ([BLUE] OR [GREEN])

          THEN "True"

          ELSE "False"

          END

           

          Instead of OR, I would suggest using a IIF or IF THEN ELSE or if those don't work a CASE statement (note: case statements are resource-intensive and may cause performance issues if not optimized)

          Check out this KB article: http://onlinehelp.tableau.com/current/pro/online/windows/en-us/help.htm#functions_functions_logical.html

           

          Hope this helps!