在 MDX 查询中将字符串值转换为日期类型并包含一些空白行时,会发生类型不匹配错误
我的 SSAS
多维数据集中有一个字符串类型维度,其中包含日期值和一些空白值,请查找屏幕截图以供参考。
我正在尝试使用 CDate< MDX
查询中的 /a> 函数。我使用了以下 MDX 查询,当值为空或 null 时,该查询将返回 null,并返回有效值的日期值。
WITH
MEMBER [Measures].[Company].[OrderDate] AS 'CASE WHEN ISEMPTY([Company].[OrderDate].CurrentMember.MemberValue) OR [Company].[OrderDate].CurrentMember.MemberValue = null THEN null Else CDate([Company].[OrderDate].CurrentMember.MemberValue) END' SELECT{
[Measures].[Company].[OrderDate]} ON COLUMNS ,Subset(NONEMPTY((
(Order((([Company].[OrderDate].[OrderDate].ALLMEMBERS)), CDate([Company].[OrderDate].CurrentMember.Member_Caption),ASC))),{[Measures].DefaultMember}),0,100) ON ROWS FROM [Model] CELL PROPERTIES VALUE, FORMATTED_VALUE, FORMAT_STRING
但是,当我尝试将这些字符串值转换为日期时,我收到类型不匹配错误,如以下屏幕截图所示:
任何人都可以建议如何将字符串维度值转换为日期当维度中存在空白值时键入?
I have a string-type dimension in my SSAS
cube having the date values along with some blank values and please find the screenshot for your reference.
I am trying to convert these values into Date using the CDate function in the MDX
query. I have used the following MDX query which will return null when the value is either empty or null and returns the date value for valid values.
WITH
MEMBER [Measures].[Company].[OrderDate] AS 'CASE WHEN ISEMPTY([Company].[OrderDate].CurrentMember.MemberValue) OR [Company].[OrderDate].CurrentMember.MemberValue = null THEN null Else CDate([Company].[OrderDate].CurrentMember.MemberValue) END' SELECT{
[Measures].[Company].[OrderDate]} ON COLUMNS ,Subset(NONEMPTY((
(Order((([Company].[OrderDate].[OrderDate].ALLMEMBERS)), CDate([Company].[OrderDate].CurrentMember.Member_Caption),ASC))),{[Measures].DefaultMember}),0,100) ON ROWS FROM [Model] CELL PROPERTIES VALUE, FORMATTED_VALUE, FORMAT_STRING
However, When am trying to convert these string values into Date I am getting the Type mismatch error as shown in the following screenshot:
Can anyone please suggest how to convert the string dimension values to date type when blank values are present in the dimension?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论