父子关系的 MDX 查询

发布于 2024-10-07 15:11:14 字数 643 浏览 0 评论 0原文

我有一个 OLAP 基本上有一个具有父子关系的维度。 所以维度有一个parent-id 和一个child-id。

存在一个包含 child-id 的事实表。当我提供父 ID 时,我想获取一个孩子及其所有给定孩子的数据。

我如何在 MDX 查询中实现这一目标?

 <Dimension foreignKey="child_id"  name="SUPPLIER">
  <Hierarchy hasAll="true" allMemberName="all" allMemberCaption="all" primaryKey="child_id" >
    <Table name="suppliers">
    </Table>
    <Level name="SUPPLIER_L"  column="child_id" nameColumn="child_id" parentColumn="parent_id"  
    uniqueMembers="true" levelType="Regular" hideMemberIf="Never" >
    </Level>
  </Hierarchy>
</Dimension>

我有这个层次结构发生的维度。

I have an OLAP Basically there is a dimension that has parent-child relationship.
So the dimension has a parent-id and a child-id.

There is a fact table that exists that has the child-id. I would like to get data for a child and all its given children when I provide the parent id.

How could I achieve this in a MDX query ?

 <Dimension foreignKey="child_id"  name="SUPPLIER">
  <Hierarchy hasAll="true" allMemberName="all" allMemberCaption="all" primaryKey="child_id" >
    <Table name="suppliers">
    </Table>
    <Level name="SUPPLIER_L"  column="child_id" nameColumn="child_id" parentColumn="parent_id"  
    uniqueMembers="true" levelType="Regular" hideMemberIf="Never" >
    </Level>
  </Hierarchy>
</Dimension>

I have my dimension where this hierarchy occurs.

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

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

发布评论

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

评论(2

音盲 2024-10-14 15:11:14

看一下 DESCENDANT MDX 函数。

您只需说出要在层次结构中从哪里开始,然后在哪个级别停止即可。然后它会给你起点和终点之间的所有级别。

发布您的蒙德里安模式立方体的一部分,以便我可以为您提供确切的语法

Take a look at the DESCENDANT MDX function.

You just say where you want to start in the hierachy and then where you want to stop at what level. Then it will give you all the level between start and end points.

Post the part of your mondrian schema cube so I can give you the exact syntax

怼怹恏 2024-10-14 15:11:14

以下 MDX 应该为您提供 'your-parent-id' 下的子树:

SELECT
[措施].[您的措施] 为 0,
后代([供应商].&[您的父级 ID]、[供应商].&[您的父级 ID].级别、SELF_AND_AFTER)ON 1
来自 [你的立方体]

The following MDX should give you the sub-tree under 'your-parent-id' :

SELECT
[Measures].[your-measure] on 0,
Descendants( [Supplier].&[your-parent-id], [Supplier].&[your-parent-id].level, SELF_AND_AFTER) ON 1
FROM [your-cube]

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