mdx crossjoin over Dimention hierarchy with granular measures results in duplicate statistics of Reporting Services 数据集

mdx crossjoin over dimention hierarchy with granular measures results in duplicate statistics of Reporting Services data set

我在 Visual Studio 2005 年通过 SSAS 2008 R2 Qube 数据源构建了一个 SSRS 收入报告,用于部署在 MS SharePoint 2005 Server 上。它运行良好(俄语):

(哎呀,不能post图片低于10分声望)

但问题是报告的 mdx 在不同的度量中输出重复的 x2/x3/x4/x10 统计数据,这些统计数据被加载到日历层次结构的不同级别(一些计划具有每年粒度,其他季度,事实数据位于 leafe确切日期的水平)。这是 mdx 代码摘要:

/* Revenue plan-fact report for business units 
   (simplified translated abstact,
    initially built for new 2015 and old clients) */

    /*============================================================================
      CALCULATED MEASURES
      ============================================================================*/

        WITH    
        MEMBER [is new client] AS 
        CASE       
        WHEN [Clients].[First contract calendar].CURRENTMEMBER = 
             [Clients].[First contract calendar].[Year START DATE].&[2015-01-01T00:00:00] 
        THEN 1 ELSE 0 END       

        MEMBER [Measures].[New clients - Revenue Plan] AS 
               CASE WHEN [is new client] = 1 
               THEN [Measures].[New clients - Revenue Plan]
               ELSE null END

        MEMBER [Measures].[New clients - Revenue Fact] AS 
               CASE WHEN [is new client] = 1 
               THEN [Measures].[New clients - Revenue Fact]
               ELSE null END

        MEMBER [Measures].[New cients - contracts Plan] AS 
               CASE WHEN [is new client] = 1
               THEN [Measures].[New cients - contracts Plan]
               ELSE null END

    /*============================================================================
      CONSTRACT DATA SET
      ============================================================================*/

        SELECT {[Measures].[New clients - Revenue Plan],
                [Measures].[New clients - Revenue Fact],
                [Measures].[New cients - contracts Plan]} ON COLUMNS,

        --exists(
        --nonempty(    
        CrossJoin(
                  -- dimention of client's first contract calendar 
                  -- (we need it to calculate measure of new/old client flag):
                  -- drill down from years through quarters to monthes

                  Hierarchize(DrilldownMember({
                              {DrilldownLevel({[Clients].[First contract calendar].[Year START DATE]})}},
                                              {[Clients].[First contract calendar].[Quarter START DATE]})
                              -{[Clients].[First contract calendar].[Month START DATE].&[1899-12-30T00:00:00]}),

                  -- dimention of company's business structure (to show in report rows)

                  Hierarchize(DrilldownMember({
                              {DrilldownLevel({[Business structure].[Hierarchi].[ALL]})}},
                                              {[Business structure].[Hierarchi].[LV1].&[3]})
                              -{[Business structure].[Hierarchi].[ALL],                            
                                [Business structure].[Hierarchi].[LV1].&[3],
                                [Business structure].[Hierarchi].[LV2].&[3]})               
                  )
        --))        
        ON ROWS 

        FROM [DWH_FD_client_count]

这导致数据集在不同级别的日历层次结构中加倍统计:

(哎呀,不能post图片低于10分声望)

我尝试过 exists()、nonempty()、nonemptycrossjoin() 和 filter() 函数 - 但它们都会导致部分业务部门的统计数据出现差距。我认为根本问题是 Qube 的度量粒度。但我无法影响它,我需要在 Report Server 的 mdx 方面制作精美的数字。可能是,我需要修改 [Clients].[First contract calendar] 度量层次结构的向下钻取块。

伙计们,请帮助我!我现在两周都解决不了这个问题

也许您需要将自定义度量包装在 SumAggregate 中。尽管这些措施应该是递归的吗?您可能想尝试更改名称 - 我刚刚添加了 XX 以将它们与定义中使用的度量区分开来:

    MEMBER [Measures].[New clients - Revenue Plan XX] AS
      SUM(               
         CASE WHEN [is new client] = 1 
           THEN [Measures].[New clients - Revenue Plan]
           ELSE null END
         )
    MEMBER [Measures].[New clients - Revenue Fact XX] AS 
      SUM(               
         CASE WHEN [is new client] = 1 
           THEN [Measures].[New clients - Revenue Fact]
           ELSE null END
         )

    MEMBER [Measures].[New cients - contracts Plan XX] AS 
      SUM(               
         CASE WHEN [is new client] = 1 
           THEN [Measures].[New cients - contracts Plan]
           ELSE null END
         )

这是对我有用的解决方案。问题似乎出在 [Clients].[First contract calendar] 维度的层次结构钻取中,导致其级别错误交叉连接,输出行数过多,统计数据加倍。为了使 mdx 正常工作,我刚刚替换了这个代码块:

Hierarchize(DrilldownMember({
                          {DrilldownLevel({[Clients].[First contract calendar].[Year START DATE]})}},
                                          {[Clients].[First contract calendar].[Quarter START DATE]})
                          -{[Clients].[First contract calendar].[Month START DATE].&[1899-12-30T00:00:00]})

仅调用一个层次结构属性:

[Clients].[First contract calendar].[Month START DATE]

注意:Reporting Services 中的输出数据集不仅产生月列,而且还产生它的所有父层次结构级别:年和季度,我最初尝试使用函数 Drilldownmember() 和 Drilldownlevel() 生成