MDX - 将成员值转换为 CDate

MDX - Converting Member Value to CDate

我需要将成员值从这种格式 dd.MM.yyyy 转换为 CDate。
这是我的审判:

cdate(format([Date].[Date].CURRENTMEMBER.MEMBER_VALUE, "dd.MM.yyyy"))
资料来源:http://www.datazen.com/blogs/post/working-with-dates-in-datazen-3-0

但是,我收到类型不匹配错误,因为格式功能无法正常工作。
我正在使用 Microsoft 分析服务器。

有人知道这个问题的解决方案吗?

您需要创建一个度量何时提取日期。

这是一条可能的路线:

MEMBER [Measures].[Date as int] as
       [Date].[Date].CURRENTMEMBER.Properties('Key0', Typed)
MEMBER [Measures].[Date Year] as
       Fix([Measures].[Date as int] / 10000)
MEMBER [Measures].[Date Month] as
       Fix(([Measures].[Date as int] - [Measures].[Date Year] * 10000) / 100)
MEMBER [Measures].[Date Day] as
       [Measures].[Date as int] - [Measures].[Date Year] * 10000 - [Measures].[Date Month] * 100

MEMBER [Measures].[DateValue_attempt1] as
       // convert it to Date data type and use a format string on that:
       DateSerial([Measures].[Date Year], [Measures].[Date Month], [Measures].[Date Day]),
       format_string = 'dd.MM.yyyy'
MEMBER [Measures].[DateValue_attempt2] as
       //if above fails maybe just convert it to string & do further conversion in client
       [Measures].[Date Day] + "." +
          [Measures].[Date Month] + "." +
             [Measures].[Date Year]