7 Replies Latest reply on Sep 9, 2010 7:59 AM by Ryan Morrisroe

    CASE EXPRESSION WHEN QUERYING SSAS CUBE

    . chandr.gp

      I am trying to evaluate a case expression and create a calculated field based on that, I am querying the SSAS cube, when I do the following I got the error expected ‘THEN’ to match ‘IF’ at character 0

       

      IF FIND(SUBSTRING([company],companyid,5,3)) like 'A%' THEN 'ATLANTA'

      ELSEIF FIND(SUBSTRING([company],companyid,5,3)) like 'H%' THEN 'HOUSTON'

      ELSEIF FIND(SUBSTRING([company],companyid,1,7)) like 'O%' THEN 'MOBILE'

      ELSEIF FIND(SUBSTRING([company],companyid,5,3)) like 'N%' THEN 'NORTH'

      ELSE 'RestOfAll'

      END

       

       

      Help Highly Appreciated.

       

      Thanks