MDX查找并替换字符串

时间:2015-04-14 13:01:02

标签: sql-server-2008 ssas mdx ssas-2008

我正在使用MDX查询我有这样的查询:

SELECT non empty {[Measures].[value]} on columns, Non empty { [DimY].   [Year].[Year] } on rows  FROM myTab

查询返回一个像这样的值

                 Value
calendar 1998      10
calendar 1999      20

我想要的是删除日历字符串并获得此结果

              Value
     1998      10
     1999      20

1 个答案:

答案 0 :(得分:2)

正如Sourav所说,你可以这样做:

With MEMBER Measures.[Yr] AS
    VBA!Right([DimY].[Year].currentmember.Name,4)
SELECT 
    non empty 
        {
            Measures.[Yr]
           ,[Measures].[value]
        } ON COLUMNS, 
    Non empty 
       [DimY].[Year].[Year].members ON ROWS
FROM myTab