MDX 查找和替换字符串

MDX find and replace a string

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

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

查询 return 我这样的值

                 Value
calendar 1998      10
calendar 1999      20

我想要的是删除日历字符串并得到这个结果

              Value
     1998      10
     1999      20

正如 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