title: Where condition in calculated member in OLAP cube
body: <p>I am new to MDX and want to develop SSAS cube and need some help on following scenario :</p>
  <p>In the SSAS designer, on the Calculations tab:</p>
  <p>I am creating one calculated member called [QualityKPI] for which I am writing MDX expression as below :</p>
  <pre><code>IIF([Measures].[Rows Count] &lt;&gt; 0 and [Measures].[Coefficient] &lt;&gt; 0, [Measures].[QualityFinal]/[Measures].[Coefficient],IIF([Measures].[Rows Count] &lt;&gt; 0 and [Measures].[Coefficient] = 0,[Measures].[Quality]/[Measures].[NumberofRecords],Null))
  </code></pre>
  <p>But how do I implement here WHERE condition ?</p>
  <p>For ex., in my fact table I have a column [Rows Count] with two distinct values of 1 and 0.</p>
  <p>I want to implement above MDX expression such that it only considers Rows Count=1 while doing the above calculation.</p>
  <p>As an example I have a some records like below and the QualityKPI for each row should yields this results and the formula return exactly the same:</p>
  <p><a href="https://i.stack.imgur.com/UX0PQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UX0PQ.png" alt="enter image description here" /></a></p>
  <p>However on aggregation level (Lets say I want to calculate the QualityKPI for all products), I want to consider only records which their [Rows Count] is equal to 1 and therefore the aggregation should yields 0.5496 (<code>(0.209948793 + 0 + 0 + 0) / (0.209948793 + 0 + 0 + 0.172043011 )</code>)but with above formula it yields 0.18087 (<code>(0 + 0.005869074 + 0 + 0 + 0.209948793 + 0 + 0 + 0) / (0 + 0.005869074 + 0 + 0.805352798 +  0.209948793 + 0 + 0 + 0.172043011 )</code>).</p>
  <p>Any help is appreciated.</p>