在 MDX 查询中将字符串值转换为日期类型并包含一些空白行时,会发生类型不匹配错误

发布于 2025-01-11 01:01:27 字数 1307 浏览 4 评论 0原文

我的 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.

enter image description here

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:

enter image description here

Can anyone please suggest how to convert the string dimension values to date type when blank values are present in the dimension?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文