2 Replies Latest reply on Aug 30, 2012 11:47 AM by Mark Holtz

    ELSEIF Condition - Calculated Field.

    Imran Islam

      Hi There,

       

      Was wondering if someone could help me with a calculated field ELSEIF condition.  Below is what I am using:

       

      IF [COMP_CSA] = 0 and [OS] = 'WINDOWS' THEN "Non Compliant CSA"

      ELSEIF [COMP_NAMING] = 0 and [OS] = 'WINDOWS' THEN "Non Compliant Naming"

      ELSEIF [COMP_AV] = 0 and [OS] = 'WINDOWS' THEN "Non Compliant AV"

      ELSEIF [COMP_PATCH] = 0 and [OS] = 'WINDOWS' THEN "Non Compliant Patching (Sev 5)"

      ELSEIF [REG_ALT_DESKTOP] = 0 AND [OS] = WINDOWS' THEN "Non Compliant Altiris"

      ELSE "Compliant"

      END

       

      The data returned is not what I expect, this is happening because each record can meet the above listed conditions a number of times for example a record could be [COMP_NAMING] = 0 and [COMP_PATCH] = 0.  What appears to happen is that when a record is matched against the first true condition then the record is not compared again against the other conditions whch is skewing my numbers.

       

      Is there a way of having the data recalculated for each condition ?

       

      I'd appreciate any pointers.

       

      Thanks

      Imran

        • 1. Re: ELSEIF Condition - Calculated Field.
          Tracy Rodgers

          Hi Imran,

           

          Your observation is correct, if the first condition is met, then it is only taken into account for that condition. Multiple calculations may need to be created for each dimension to show whether the condition is being met. Is it possible to post a packaged workbook (twbx file)?

           

          -Tracy

          • 2. Re: ELSEIF Condition - Calculated Field.
            Mark Holtz

            Could you create a new measure field for each logic test you wish to conduct?

             

            Create a field called Non Compliant CSA:

            IF [COMP_CSA] = 0 and [OS] = 'WINDOWS' THEN 1 ELSE NULL END

             

            Create a field called Non Compliant Naming:

            IF [COMP_NAMING] = 0 and [OS] = 'WINDOWS' THEN 1 ELSE NULL END

             

            and so on...

             

            Then the sum of each measure should return the count of rows that trip each logical test--and a single row could potentially trip each one of the tests.