title: MDX If statement syntax
body: <p>I'm working on a calculated measure in SQL Server Analysis Service. the case is as follows;</p>
  
  <p>we have a string value that holds a 4 digit numeric value. if the value starts with 7 we want to add a value with another value, if not then we just want to display the value.</p>
  
  <p>i tried to use a when statement first, with a then and an else portion;</p>
  
  <pre><code>Case
  
      when (Left([Kostensoort].[Kosten code], 1) is "7")
          Then [Measures].[Inkoop bedrag] + [Measures].[Bank bedrag]
          Else [Measures].[Inkoop bedrag]
  End
  </code></pre>
  
  <p>this doesn't seem to work.</p>
  
  <p>i then changed it to an if statement like this;</p>
  
  <pre><code>if  (Left([Kostensoort].[Kosten code], 1) is "7")
      then [Measures].[Inkoop bedrag] + [Measures].[Bank bedrag]
      else [Measures].[Inkoop bedrag]
  end if 
  </code></pre>
  
  <p>it keeps saying there is an error at the then keyword, which leads me to believe i did something wrong with the if statement</p>
  
  <p>i also replaced the is with a '=' to see if that mattered, which it didn't</p>
  
  <p>i found multiple sources on the internet saying what i can and can't do in a mdx expression;</p>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/ms145517.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms145517.aspx</a>
  <a href="http://www.iccube.com/support/documentation/mdx/functions.html" rel="nofollow">http://www.iccube.com/support/documentation/mdx/functions.html</a>
  <a href="http://publib.boulder.ibm.com/infocenter/comphelp/v101v121/index.jsp?topic=/com.ibm.xlf121.aix.doc/proguide/ifclause.html" rel="nofollow">http://publib.boulder.ibm.com/infocenter/comphelp/v101v121/index.jsp?topic=/com.ibm.xlf121.aix.doc/proguide/ifclause.html</a>
  <a href="http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/index.jsp?topic=%2Fcom.ibm.dwe.cubemdx.doc%2Fmdx_expressions.html" rel="nofollow">http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/index.jsp?topic=%2Fcom.ibm.dwe.cubemdx.doc%2Fmdx_expressions.html</a></p>
  
  <p>but none seem to solve my problem.</p>
  
  <p>obvouisly im missing something, is there anyone there that has expercience with MDX and SSAS, that can give me a few pointers or a direction?</p>