如何在MDX中将列定义为double的数据类型?

时间:2012-10-29 12:25:11

标签: ssas mdx

我是MDX和分析服务的新手,所以请耐心等待。当我运行以下MDX查询时,结果值返回为列A-I的双精度数,但是当元素应为double时,列元数据显示数据类型为对象类型。如何强制它识别数据类型为double,我甚至可以这样做吗?我不确定它是如何推断出它是对象类型。

WITH
        MEMBER [Column (A)] AS [Measures].[ColumnA]
        MEMBER [Column (B)] AS [Measures].[ColumnB]
        MEMBER [Column (C)] AS [Measures].[ColumnC]
        MEMBER [Column (D)] AS [Measures].[ColumnD]
        MEMBER [Column (E)] AS [Measures].[ColumnE]
        MEMBER [Column (F)] AS [Measures].[ColumnF]
        MEMBER [Column (G)] AS [Measures].[ColumnB] - [Measures].[ColumnA]
        MEMBER [Column (H)] AS [Measures].[ColumnD] - [Measures].[ColumnC]
        MEMBER [Column (I)] AS [Measures].[ColumnF] - [Measures].[ColumnE]
        SELECT 
        NON EMPTY
        {
            Column (A),
            Column (B),
            Column (C),
            Column (D),
            Column (E),
            Column (F),
            Column (G),
            Column (H),
            Column (I)
        } ON COLUMNS,
        NON EMPTY
        CROSSJOIN(
            CROSSJOIN([T].[TB].[TB],

                  [T].[TT].[TT]),

                  [T].[TR].[TR])  
        ON ROWS
        FROM RePro          
        WHERE 
        (
            [RS].[RS].[EOD],
                [RD].[RD].[DATE],
                [P].[P].[ABCD]
        )
        CELL PROPERTIES VALUE

提前致谢

2 个答案:

答案 0 :(得分:0)

您可以尝试CDbl功能。我在其上找到的一些例子:
Casting nvarchar to Decimal using MDX
Mean, Median and Mode in MDX

答案 1 :(得分:0)

我可能在这里错过了一些上下文,但[Measures].[ColumnA]本身是decimal(或money)吗?

如果是,您是否可以尝试对MDX进行轻微更改,而不是

WITH MEMBER [Column (A)] ...

将其改为

WITH MEMBER [Measures].[Column (A)] AS [Measures].[ColumnA] 

这样,当您保持相同的度量上下文时,数据类型定义将完全传播。