【问题标题】:calculating the difference of the same measure with a 'different definition' in MDX在 MDX 中使用“不同定义”计算相同度量的差异
【发布时间】:2014-06-16 04:00:40
【问题描述】:

我想用“不同的定义”计算相同度量的差异 这是我尝试过的,但它不起作用:

 WITH MEMBER [Measures].[Births] AS 
'[Measures].[type], [dimType].[TypeL].[Births]' 
 MEMBER [Measures].[Deaths] AS 
'[Measures].[type], [dimType].[TypeL].[Deaths]' 
 MEMBER [Measures].[Population_Growth] AS 
'[Measures].[Births] - [Measures].[Deaths]' 
 SELECT [Measures].[Population_Growth] ON COLUMNS, 
 [dimTime].[year] ON ROWS FROM [Population]

运行此查询时,我每年都会得到 Population_Growth = 0。 我是 MDX 新手,不知道自己做错了什么?

【问题讨论】:

    标签: mysql mdx olap


    【解决方案1】:

    不确定。在 MDX 中,您已经评估了一个元组。如果您只有一个成员,则不需要括号,但如果您有多个成员,则需要它们。可以试试吗

    WITH 
      MEMBER [Measures].[Births] AS ([Measures].[type], [dimType].[TypeL].[Births]) 
      MEMBER [Measures].[Deaths] AS ([Measures].[type], [dimType].[TypeL].[Deaths]) 
      MEMBER [Measures].[Population_Growth] AS [Measures].[Births] - [Measures].[Deaths]
    SELECT
     [Measures].[Population_Growth] ON COLUMNS, 
     [dimTime].[year] ON ROWS 
    FROM [Population]
    

    如果这不起作用,则可能是 [type] 度量:

    WITH 
      MEMBER [Measures].[Births] AS ([Measures].defaultmember, [dimType].[TypeL].[Births]) 
      MEMBER [Measures].[Deaths] AS ([Measures].defaultmember, [dimType].[TypeL].[Deaths]) 
      MEMBER [Measures].[Population_Growth] AS [Measures].[Births] - [Measures].[Deaths]
    SELECT
     [Measures].[Population_Growth] ON COLUMNS, 
     [dimTime].[year] ON ROWS 
    FROM [Population]
    

    如果这不起作用,我们可以检查成员 [dimType].[TypeL].[Births] 是否正常。

    WITH 
      MEMBER [Measures].[Population_Growth] AS [dimType].[TypeL].[Births].name
    SELECT
     [Measures].[Population_Growth] ON COLUMNS, 
     [dimTime].[year] ON ROWS 
    FROM [Population]
    

    应该返回 'Births'

    【讨论】:

      猜你喜欢
      • 2016-04-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-07
      • 1970-01-01
      • 2021-04-13
      • 2019-11-18
      相关资源
      最近更新 更多