Market Share Calculation in MDX based on AXIS

Below is the MDX which will calculate market share at runtime/dynamically. It always reads data from the parent axis. iif  (   Axis(1)(0)(Axis(1)(0).Count – 1).Dimension.CurrentMember.Parent is null,   null,    (      [measures].[x]      /      (     [measures].[x],Axis(1)(0)(Axis(1)(0).Count -1).Dimension.CurrentMember.Parent    )   )     * 100  )

MAT (Moving Annual Total), YTD (Year to date) calculation using BottomCount, Tail, Properties function in MDX

I was just trying to create two calculated memebers (MAT1, MAT2) under period dimension in my cube and came up with this solution. First, I am trying to explain MAT1 and MAT2. MAT1 : Last 12 months from the current month. If the current month is Jun’2011, MAT1 will be the months from Jul’2010 to Jun’2011. MAT2: … More MAT (Moving Annual Total), YTD (Year to date) calculation using BottomCount, Tail, Properties function in MDX