【问题标题】:mdx crossjoin over dimention hierarchy with granular measures results in duplicate statistics of Reporting Services data setmdx 跨维度层次结构与粒度测量交叉连接导致 Reporting Services 数据集的重复统计信息
【发布时间】:2015-04-21 15:47:50
【问题描述】:

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

(哎呀,不能发布低于 10 点声望的图片)

但问题是报告的 mdx 以不同的度量输出重复的 x2/x3/x4/x10 统计数据,这些统计数据被加载到不同级别的日历层次结构中(一些计划具有每年粒度,其他季度,事实数据位于叶子中确切日期的级别)。这是 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]

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

(哎呀,不能发布低于 10 点声望的图片)

我已经尝试过exists()、nonempty()、nonemptycrossjoin() 和filter() 函数——但这都会导致部分业务部门的统计数据出现空白。我认为根本问题是 Qube 测量的粒度。但我不能影响这一点,我需要在 Report Server 的 mdx 一侧制作好数字。可能是,我需要修改 [Clients].[First contract calendar] 度量层次结构的钻取块。

请帮帮我,伙计们!我到现在两周都无法克服这个问题

【问题讨论】:

  • 您是否尝试将自定义度量封装在 AggregateSum 中?
  • 我在 .rdl 中使用分组,我没有尝试过 Aggregate,我的 mdx 中也没有 Sum

标签: mdx duplicate-data rdl cross-join granularity


【解决方案1】:

也许您需要将自定义度量值包装在 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
         )

【讨论】:

  • 为什么,我尝试将 sum() 用于计算成员 - 它没有帮助,统计数据仍然存在问题。无论如何,谢谢你的建议
  • @Globe 您是否更改了措施的名称?!还是它们是故意递归的?
  • 原始 mdx 确实有唯一的计算度量名称,这与 Qube 中的不同
【解决方案2】:

这是对我有用的解决方案。问题似乎出现在 [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 中的输出数据集不仅生成 Monthes 列,而且还生成所有父层次结构级别:Years 和 Quarters,我最初尝试使用函数 Drilldownmember() 和 Drilldownlevel() 生成它们

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多