使用 MDX Correlation() 函数查找 2 维成员的相关性

发布于 2024-09-29 09:37:38 字数 247 浏览 1 评论 0原文

我试图找到维度的两个成员之间单个度量的皮尔逊相关性,但是 msdn 文档 有点稀疏。具体来说,我有一个带有 fact count 度量、date 维度和 tool 维度的多维数据集,我想找到以下相关性日期维度上的工具 X 和工具 Y。

I'm trying to find the Pearson correlation of a single measure between two members of a dimension, but the msdn docs are a bit sparse. Specifically I have a cube with a fact count measure, a date dimension, and a tool dimension and I'd like to find the correlation of tool X and tool Y over the date dimension.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

毁虫ゝ 2024-10-06 09:37:38

看一下以下脚本(Adventure Works DW 2008 R2):

它将返回行( 2007 日历年季度和 2007 日历年)。我在评论中留下了其他类似的成员。

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,

赫尔沃耶·皮亚塞沃利

take a look at the following script (Adventure Works DW 2008 R2):

It will return correlation of [Internet Sales Amount] measure for two different product subcategories ("Mountain Bikes"/"RoadBikes") for months of current date member on rows (Calendar Year 2007 quarters and Calendar Year 2007). I have left other comparable members in comments.

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,

Hrvoje Piasevoli

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文