title: using scope with calculated member
body: <p>I have problem in my calculated member. Whenever this member involve in calculation or query it take large time to execute. I am trying to narrow down execution time. 
  I have to remove IIF condition from the members and start using scope instead.</p>
  
  <pre><code>CREATE Member CurrentCube.[Measures].[AvgAmount]  as
  IIF(ISLeaf([Customer].[ParentCustomer].currentmember),
      [Measures].[Value], 
      (SUM([CCube^Customer].[ParentCustomer].CURRENTMEMBER.CHILDREN) /
       COUNT([Customer].[ParentCustomer].CURRENTMEMBER.CHILDREN))
     ) , 
  Format_String = "#.0000000;-#.0000000;0;0",
  Non_Empty_Behavior = [Measures].[Amout];
  </code></pre>
  
  <p>I have created hierarchy of customer which is [ParentCustomer] here.  I want to see avg amount of all the children under the parent customer but when I am looking child level which does not have any children in it should only show the [Measures].[Amout].</p>
  
  <p>Thanks in advance</p>
  
  <p>Regards,
  Sam</p>