代码之家  ›  专栏  ›  技术社区  ›  Jeff Mc

使用MDX Correlation()函数查找二维构件的相关性

  •  2
  • Jeff Mc  · 技术社区  · 14 年前

    我试图找到一个维度的两个成员之间的皮尔逊相关度,但是 msdn docs fact count 测量,a date 尺寸,和 tool 维,我想找出工具X和工具Y在日期维上的相关性。

    1 回复  |  直到 14 年前
        1
  •  1
  •   Hrvoje Piasevoli    14 年前

    请看下面的脚本(Adventure Works DW 2008 R2):

    with 
    member ActualMeasure    AS  [Measures].[Internet Sales Amount]
    
    member m1 AS 
    (
        [Product].[Product Categories].[Subcategory].&[1] -- Mountain Bikes
    --  [Sales Territory].[Sales Territory].[Group].&[North America]
    --  [Customer].[Gender].&[F]
        ,ActualMeasure
    )
    member m2 AS 
    (
        [Product].[Product Categories].[Subcategory].&[2] -- Road Bikes
    --  [Sales Territory].[Sales Territory].[Group].&[Europe]
    --  [Customer].[Gender].&[M]
        , ActualMeasure
    )
    member x as
    Correlation
    (
        {Descendants([Date].[Calendar].CurrentMember,[Date].[Calendar].[Month]) } as dates
        , m1
        , m2
    ), Format_String="Standard"
    
    select
    {   x,m1,m2 } on 0,
    {
        Descendants
        (
            [Date].[Calendar].[Calendar Year].&[2007]
            , [Date].[Calendar].[Calendar Quarter]
        )  
        ,[Date].[Calendar].[Calendar Year].&[2007]
    } on 1
    from [Adventure Works]
    

    HTH公司,