title: MDX, SSAS 2005 calculating SPLY (Same Period Last Year)
body: <p>I'm trying to achieve the following: I have a measure: <em>[Measures].[Sales]</em> and a time dimmension: <em>[Time].[Year - Month - Day].</em> I would like to add new measure: <em>[Measures].[Sales SPLY]</em> to work in the following way:</p>
  
  <p>MONTH-----------------Sales--------------Sales SPLY</p>
  
  <p>2009 January--------120 000,00--------110 000,00</p>
  
  <p>2009 February ------100 000,00--------90 000,00</p>
  
  <p>2009 March----------120 000,00--------110 000,00</p>
  
  <p>TOTAL:---------------340 000,00--------<strong>290 000,00</strong></p>
  
  <p>The value of [Sales SPLY] is calculates using the following way: I created a new Sum measure, and in a Cube Script I replace it with the following code:</p>
  
  <pre><code>([Measures].[Sales SPLY], Leaves([Time])) = (PARALLELPERIOD([Time].[Year - Month - Day].[Year],1,[Time].[Year - Month - Day].currentmember), [MEASURES].[Sales])
  </code></pre>
  
  <p>It's working, however is just very, very slow. Does anyone know a better way of writing this MDX? using only the parrarel period in a calculated member will result in a bad value of the Total in SPLY measure. Please, I googled a lot and couldn't find any thing better than this. </p>