Calculations Based of Customers Start Date

  • Good Day.

    I am very new to MDX and been thrown in the deep end, what I am trying to accomplish is to calculate the age in days of each customer since the customer last purchase date, as well as sum all their purchase history between the last purchase date going back a certain amount of time i.e 12 months or 365 days.

    I tried something like this but totally stumped. I tried searching the site for an answer but could not find anything similar.

    with member

    [measures].[MyCalc]

    as

    SUM(EXISTING [Measures].[PurchaseAmount],[Customer].[Last Purchase Date].lag(365):[Customer].[Last Purchase Date])

    select

    {[measures].[MyCalc]} on columns,

    {[Customer].[Display Name].children * [Customer].[Last Purchase Date].children *} on rows

    from

    [Purchases]

    Thank you in advance

    Scott

  • Have a read of the following from Chris Webb:

    https://cwebbbi.wordpress.com/2011/03/24/last-ever-non-empty-a-new-fast-mdx-approach/

    You should be able to expand upon what is there and to what you need to.


    I'm on LinkedIn

Viewing 2 posts - 1 through 1 (of 1 total)

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