MDX 查询未正确过滤

发布于 2024-09-24 12:22:11 字数 731 浏览 0 评论 0原文

我有以下星型架构:

Objects       <-> Facts         <-> Simulation
-ObjectID         -ObjectID         -SimulationID
-SimulationID     -SimulationID     
-ObjHierarchy     -Volume
-ObjectType

现在我尝试使用两个维度过滤多维数据集:

select [Measures].[Volume] on columns,
[Objects].[ObjHierarchy].[Level 02] on rows
from [DM OC]
where ([Objects].[ObjectType].&[2], [Simulation].[SimulationID].&[52])

但是,这会返回 SimulationID=52 的行(带有值),但也会返回 SimulationID=53 的重复行 (带有空值):

ObjHierarchy | Volume
MyObj1       | 12345
MyObj2       | 54321
MyObj1       | (NULL)
MyObj2       | (NULL)

解决方法是使用 NonEmpty,但似乎立方体的建模方式不正确。

I have the following star schema:

Objects       <-> Facts         <-> Simulation
-ObjectID         -ObjectID         -SimulationID
-SimulationID     -SimulationID     
-ObjHierarchy     -Volume
-ObjectType

Now I'm trying to filter the cube using both dimensions:

select [Measures].[Volume] on columns,
[Objects].[ObjHierarchy].[Level 02] on rows
from [DM OC]
where ([Objects].[ObjectType].&[2], [Simulation].[SimulationID].&[52])

However, this returns rows for SimulationID=52 (with values) but also duplicates for SimulationID=53 (with nulls):

ObjHierarchy | Volume
MyObj1       | 12345
MyObj2       | 54321
MyObj1       | (NULL)
MyObj2       | (NULL)

A workaround is to use NonEmpty, however it just seems the cube isn't modeled the right way.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

人事已非 2024-10-01 12:22:11

这是常见情况,并不意味着立方体的模型错误。

在 MDX 中,如果您不希望行出现在结果中,还应该使用任何筛选函数来筛选行。在您的情况下,您应该使用 NonEmtpy 来消除空值。

It is a usual case and doesn't mean that the cube's model wrong.

In MDX, you should also filter the rows by using any filter function if you don't want them to appear in your result. In your case, you should use NonEmtpy to eleminate the empty values.

终难遇 2024-10-01 12:22:11

您可以执行以下操作:

将成员 XX 作为 [Objects].[ObjHierarchy].currentMember.Properties( "KEY" )

select { [Measures].[Volume], XX } on columns,
行上的 [对象].[ObjHierarchy].[级别 02]
来自 [DM OC]
其中 ([Objects].[ObjectType].&[2], [Simulation].[SimulationID].&[52])

MyObj1 和 MyObj2 不应具有相同的密钥;否则我现在看不到。

Can you execute the following :

with member XX as [Objects].[ObjHierarchy].currentMember.Properties( "KEY" )

select { [Measures].[Volume], XX } on columns,
[Objects].[ObjHierarchy].[Level 02] on rows
from [DM OC]
where ([Objects].[ObjectType].&[2], [Simulation].[SimulationID].&[52])

MyObj1 and MyObj2 should not have the same key; otherwise I do not see right now.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文