4 Replies Latest reply on May 23, 2016 2:24 AM by Imran Azam

    Calculation Error

    Imran Azam

      HI Guys i am new to this forum, and i am new to tableau, i am getting an error when doing the below calculation

       

      IF contains ([Admission Ward Name (IP Spells Dataset)],"AMU")

      OR contains([Admission Ward Name (IP Spells Dataset)],"AAA")

      And  contains([Discharge Ward Name (IP Spells Dataset)],"AMU")

      OR contains([Discharge Ward Name (IP Spells Dataset)],"AAA")

      THEN "Admitted&Dishcarged From AMU/AAA"

      ELSE IF contains ([Admission Ward Name (IP Spells Dataset)],"AMU")

      OR contains([Admission Ward Name (IP Spells Dataset)],"AAA")

      And  contains([Discharge Ward Name (IP Spells Dataset)],"AMU")= false

      OR contains([Discharge Ward Name (IP Spells Dataset)],"AAA") = false

      THEN "Admitted From AMU/AAA Discharged Other"

       

      END

       

      can anyone see what the problem is?

       

      Am i doing this wrong?

       

      Thank you

        • 1. Re: Calculation Error
          Mia Lee

          Hi, Imran

           

          Try below, if I read your logic right

           

          IF

          (

          contains ([Admission Ward Name (IP Spells Dataset)],"AMU")=True

          OR contains([Admission Ward Name (IP Spells Dataset)],"AAA")=True

          )

          And

          (

          contains([Discharge Ward Name (IP Spells Dataset)],"AMU")=True

          OR contains([Discharge Ward Name (IP Spells Dataset)],"AAA")=True

          )

          THEN "Admitted&Dishcarged From AMU/AAA"

          ELSE IF

          (

          contains ([Admission Ward Name (IP Spells Dataset)],"AMU")=True

          OR contains([Admission Ward Name (IP Spells Dataset)],"AAA")=True

          )

          And

          (contains([Discharge Ward Name (IP Spells Dataset)],"AMU")= false

          OR contains([Discharge Ward Name (IP Spells Dataset)],"AAA") = false

          )

          THEN "Admitted From AMU/AAA Discharged Other"

           

          END

           

           

           

          -Mia-

          • 2. Re: Calculation Error
            Nicholas Hara

            Hi Imram,

             

            Can you share the error text as well as a sample workbook for us to look at. There are lots of reasons a calculation may not be valid, and some sample material would help us better understand the problem.

            • 3. Re: Calculation Error
              Mahfooj Khan

              Hi,

              e.g;

              SubCat 'Pens & Art Supplies' and 'Rubeer Bands' are 'True' though we've put 'False' so its showing 'False' in Calculation1.

              You can try this,

               

              IF (contains ([Admission Ward Name (IP Spells Dataset)],"AMU")=True

              OR contains([Admission Ward Name (IP Spells Dataset)],"AAA")=True)

              And (contains([Discharge Ward Name (IP Spells Dataset)],"AMU")=True

              OR contains([Discharge Ward Name (IP Spells Dataset)],"AAA")=True)

              THEN "Admitted&Dishcarged From AMU/AAA"

              ELSEIF (contains ([Admission Ward Name (IP Spells Dataset)],"AMU")=True

              OR contains([Admission Ward Name (IP Spells Dataset)],"AAA")=True)

              And (contains([Discharge Ward Name (IP Spells Dataset)],"AMU")= False

              OR contains([Discharge Ward Name (IP Spells Dataset)],"AAA") = False)

              THEN "Admitted From AMU/AAA Discharged Other"

              END

               

              MAhfooj

              1 of 1 people found this helpful
              • 4. Re: Calculation Error
                Imran Azam

                Thank you guys for helping me