MDX Statement: Difference LastYear and YearBefore LastYear

  • Hello, I'am new to mdx.

    I would like to create am Member? which contains a Difference for a Sales Measure from LastYear -YearBefore LastYear dynamically.

    Example:
    Sales 2015: 500
    Sales 2014: 200
    New Member = 300

    The Attribut Hierachy in the Date Dimension is: Jahr
    The Measure is: RE Anzahl

    For static members (2015, 2016) in the Attribut Hierachy i can use the following Statement:

    WITH MEMBER [Belegdatum].[Jahr].[Test] as '([Belegdatum].[Jahr].[2016] - [Belegdatum].[Jahr].[2015])'
    Select
    [Measures].[RE Anzahl] on Rows,
    {[Belegdatum].[Jahr].[2015],[Belegdatum].[Jahr].[2016],[Belegdatum].[Jahr].[Test]} on Columns

    from [Rechnungen]

    How can i get it dynamically, to use the Members in the Columns?

    Thx.

  • Look at the Lag() MDX function here: https://msdn.microsoft.com/en-us/library/ms144866.aspx

    Using the above function in conjunction with the .CurrentMember property, you should be able to achieve what you need.

  • ParallelPeriod might be more appropriate.

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • Thank you,

    i solved my issue by using the ParallelPeriod Function.
    I found a helpful post for using it within all Levels here:
    https://xzwang.wordpress.com/2013/08/13/a-better-way-to-write-mdx-period-over-period-calculations/

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply