【问题标题】:MDX Calculation for summing the product of two measures and multiplying that by the last children of two other metricsMDX 计算,用于将两个度量的乘积相加并将其乘以其他两个度量的最后一个子项
【发布时间】:2016-11-05 04:38:25
【问题描述】:

这是我的多维数据集维度使用的片段:

在“TD 措施”中我有

  • [A]“当前可计费的客户小时数”。

在“人事措施”中我有

  • [B]“FTE 计数”(员工的工作量为 0.5 每周工作 20 小时的人)
  • [C]“Forecast FY End”财年末预测
  • [D]“Forecast FYTD”本财政年度迄今为止的当前期间预测。

我需要在叶级做的计算是:

[A][B][C]/[D]

问题在于 [A] 比 [B]、[C] 和 [D] 具有更多维度。

如果这是我的数据:

我需要做的计算是:

((15*.05)+(5*1)) //一段时间内的小时总和乘以该月的 FTE

X 2000/300 //FCFYE 的最后一个子代除以当前选定集合中 FCFYTD 的最后一个子代。

这个计算可能会在接下来的一两周内发生一些变化,但这是他们想要做的主要概念。非常感谢为此编写 MDX 以在我的多维数据集中创建计算成员的任何帮助。抱歉,如果我遗漏了任何关键信息——我是 MDX 菜鸟。

【问题讨论】:

    标签: ssas mdx ssas-2012


    【解决方案1】:

    通过深入研究 Chris Webb 和 Mosha 的帖子以及与 MSDN 论坛上的一些人合作,我在下面找到了解决方案。最终,我与业务合作,我们不需要询问底层行来辨别它们是否处于活动状态,因为添加根功能消除了这种需求,只要它们从 DimMiscellaneous 中过滤就可以了。但是为了帮助遇到类似问题的人,下面是完整的 MDX。

    //Only evaluate if they are active
    CREATE HIDDEN UtilizedFTESummator;    
    [Measures].[UtilizedFTESummator] = Iif([Measures].[Is Active For Utilization Value] > 0,[Measures].[Period FTE],NULL);    
    NON_EMPTY_BEHAVIOR([Measures].[UtilizedFTESummator]) = [Measures].[Is Active For Utilization Value];  
    
    //only include this measure if the underlying employee has values in their underlying data for active in utilization
    CREATE MEMBER CURRENTCUBE.[Measures].[FTE Active Utilization]
    AS
    SUM
        (   
        EXISTING [Historical Personnel].[Employee Id].[Employee Id], 
        [Measures].[UtilizedFTESummator]
        ),VISIBLE=0;  
    
    //Show weighted FTE by workdays 
    CREATE MEMBER CURRENTCUBE.[Measures].[FTE MTD Active Utilization]
     AS SUM
    (
        DESCENDANTS([Historical Personnel].[Employee Id].CURRENTMEMBER,[Historical Personnel].[Employee Id].[Employee Id]),
        (
        DIVIDE
            ( 
            SUM
                (   
                DESCENDANTS([Period].[Fiscal Period].CURRENTMEMBER,[Period].[Fiscal Period].[Fiscal Period]),
                        [Measures].[FTE Active Utilization]*[Measures].[Work Days In Month]
                )
            ,SUM(ROOT([Historical Personnel].[employee id].currentmember),[Measures].[Work Days In Month])
            ,0
            )
        )
    );
    
    //Use Weighted FTE for calculating the weighted value for each person (all periods aggregated) 
    //Forecast Billable End Of Year has default aggregation of last child
    CREATE MEMBER CURRENTCUBE.[Measures].[Annualized CBH Projected]
     AS DIVIDE 
    (
        SUM
            (
            DESCENDANTS([Historical Personnel].[Employee Id].CURRENTMEMBER,[Historical Personnel].[Employee Id].[Employee Id]),
            [Measures].[Billable Client Hours Current] *
            (
            DIVIDE
                (
                [Measures].[Forecast Billable End Of Year]
                ,       
                [Measures].[Forecast Billable FTE]
                ,0
                )
            )
            *[Measures].[FTE MTD Active Utilization]
        )
        ,[Measures].[FTE MTD Active Utilization]
        ,0
        );
    

    用户对 Is Active For Utilization 标志进行过滤的简化答案如下:

    //Weight FTE by employee calculating FTE * workdays for each period and then dividing by the sum of days irrespective of filters on historical personnel or miscellaneous
    CREATE MEMBER CURRENTCUBE.[Measures].[FTE MTD] 
    
     AS SUM
    (
        DESCENDANTS([Historical Personnel].[Employee Id].CURRENTMEMBER,[Historical Personnel].[Employee Id].[Employee Id]),
        (
        DIVIDE
        (
        SUM
            (
            DESCENDANTS([Period].[Fiscal Period].CURRENTMEMBER,[Period].[Fiscal Period].[Fiscal Period]),[Measures].[Period FTE]*[Measures].[Work Days In Month]
            ) 
            ,
            SUM((ROOT([Historical Personnel].[employee id].currentmember),ROOT([Miscellaneous]),[Measures].[Work Days In Month]))
        ,0
        )
        )
    );
    
    
    //Weight by FTE with default agg for Forecast EOY being last child.
    CREATE MEMBER CURRENTCUBE.[Measures].[Annualized CBH Projected]
     AS DIVIDE 
    (
        SUM
            (
            DESCENDANTS([Historical Personnel].[Employee Id].CURRENTMEMBER,[Historical Personnel].[Employee Id].[Employee Id]),
            [Measures].[Billable Client Hours Current] *
            (
            DIVIDE
                (
                [Measures].[Forecast Billable End Of Year]
                ,       
                [Measures].[Forecast Billable FTE]
                ,0
                )
            )
            *[Measures].[FTE MTD]
        )
        ,[Measures].[FTE MTD]
        ,0
        );
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-09
      • 1970-01-01
      • 2014-07-19
      • 1970-01-01
      相关资源
      最近更新 更多