Search code examples
ssasmdx

Named Set MDX Error


I'm having this error after creating a named set in SSAS to retrieve the last 10 weeks from the first day of current week. the expression I used is :

strtoset(
  "LASTPERIODS(
      10
     ,[AxeTemps].[Semaine].&["+Format(NOW()-WEEKDAY(NOW(),2),'yyyyMMdd')+"]")

My date hierarchy has the following members structure :

[AxeTemps].[Semaine].&[20000101].

I can't get this work, any idea ?


Solution

  • You have convert the a member first, then you can pass it to the LastPeriods():

    LastPeriods(
        10,
        StrToMember("[AxeTemps].[Semaine].&[" + Format(NOW()-WEEKDAY(NOW(),2),'yyyyMMdd') + "]")
    )