Getting LinRegSlope to work

  • Ahoi,

    i am again struggling to make MDX work and as usual i can not understand why it does not work looking at all the examples that are out there on the internet.

    What i basically need is example of the MS Docs, but i can not get it to work no matter what i try:

    LinRegSlope(LastPeriods(10),[Measures].[Unit Sales],[Measures].[Store Sales])

    LinRegSlope(LastPeriods(24),[Measures].[Measure1],[Measures].[Measure1])

    Below are my attemps at creating the measure in mdx, the only one who does not throw an error in excel is "slope3" but i need a version not for current member but for last 24 months

     

    CREATE MEMBER CURRENTCUBE.[Measures].[slope1]
    AS LinRegSlope(LastPeriods(24),[Measures].[Measure2]),
    FORMAT_STRING = "#,##0.0",
    VISIBLE = 1 , ASSOCIATED_MEASURE_GROUP = 'whatever';

    CREATE MEMBER CURRENTCUBE.[Measures].[slope2]
    AS LinRegSlope(LastPeriods(24), [Measures].[Measure1],[Measures].[Measure2]),
    FORMAT_STRING = "#,##0.0",
    VISIBLE = 1 , ASSOCIATED_MEASURE_GROUP = 'whatever';

    CREATE MEMBER CURRENTCUBE.[Measures].[slope3]
    AS LinRegSlope([TimeDimension].[CY Month].members, [Measures].[Measure1],[Measures].[Measure2]),
    FORMAT_STRING = "#,##0.0",
    VISIBLE = 1 , ASSOCIATED_MEASURE_GROUP = 'whatever';

    CREATE MEMBER CURRENTCUBE.[Measures].[slope4]
    AS LinRegSlope([TimeDimension].[CY Month].members,[Measures].[Measure2]),
    FORMAT_STRING = "#,##0.0",
    VISIBLE = 1 , ASSOCIATED_MEASURE_GROUP = 'whatever';

    CREATE MEMBER CURRENTCUBE.[Measures].[slope5]
    AS LinRegSlope([TimeDimension].[CY Month].currentmember, [Measures].[Measure1],[Measures].[Measure2]),
    FORMAT_STRING = "#,##0.0",
    VISIBLE = 1 , ASSOCIATED_MEASURE_GROUP = 'whatever';

    CREATE MEMBER CURRENTCUBE.[Measures].[slope6]
    AS LinRegSlope([TimeDimension].[CY Month].currentmember,[Measures].[Measure2]),
    FORMAT_STRING = "#,##0.0",
    VISIBLE = 1 , ASSOCIATED_MEASURE_GROUP = 'whatever';

    CREATE MEMBER CURRENTCUBE.[Measures].[slope7]
    AS LinRegSlope(LASTPERIODS(24,[TimeDimension].[CY Month]),[Measures].[Measure2]),
    FORMAT_STRING = "#,##0.0",
    VISIBLE = 1 , ASSOCIATED_MEASURE_GROUP = 'whatever';

    CREATE MEMBER CURRENTCUBE.[Measures].[slope8]
    AS LinRegSlope(LASTPERIODS(24,[TimeDimension].[CY Month]), [Measures].[Measure1],[Measures].[Measure2]),
    FORMAT_STRING = "#,##0.0",
    VISIBLE = 1 , ASSOCIATED_MEASURE_GROUP = 'whatever';

    CREATE MEMBER CURRENTCUBE.[Measures].[slope9]
    AS LinRegSlope(LASTPERIODS(24,[TimeDimension].[CY Month].currentmember),[Measures].[Measure2]),
    FORMAT_STRING = "#,##0.0",
    VISIBLE = 1 , ASSOCIATED_MEASURE_GROUP = 'whatever';

    CREATE MEMBER CURRENTCUBE.[Measures].[slope10]
    AS LinRegSlope(LASTPERIODS(24,[TimeDimension].[CY Month].currentmember), [Measures].[Measure1],[Measures].[Measure2]),
    FORMAT_STRING = "#,##0.0",
    VISIBLE = 1 , ASSOCIATED_MEASURE_GROUP = 'whatever';

    CREATE MEMBER CURRENTCUBE.[Measures].[slope11]
    AS LinRegSlope(LASTPERIODS(24,[TimeDimension].[CY Month].members),[Measures].[Measure2]),
    FORMAT_STRING = "#,##0.0",
    VISIBLE = 1 , ASSOCIATED_MEASURE_GROUP = 'whatever';

    CREATE MEMBER CURRENTCUBE.[Measures].[slope12]
    AS LinRegSlope(LASTPERIODS(24,[TimeDimension].[CY Month].members), [Measures].[Measure1],[Measures].[Measure2]),
    FORMAT_STRING = "#,##0.0",
    VISIBLE = 1 , ASSOCIATED_MEASURE_GROUP = 'whatever';

     

  • Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

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

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