如何根据两个度量和查询维度当前成员的层次结构级别创建计算成员?
我有一个多维数据集,它有
- 两个度量成员:
[Measures].[Value]
(整数)和[Measures].[EffectiveBelowLevel]
(整数)。 - 名为 [DimParentChild] 的维度,具有名为
[ParentChildHierarchy]
的不规则用户层次结构。
我想基于 [Measures].[Value]
在度量维度 ([Measures].[EffectiveValue])
上创建一个计算成员,当沿着 查询时>[DimParentChild]
和 [ParentChildHierarchy]
的行为如下:
- [Measures].[Value] is used if the hierarchy level of [DimParentChild].[ParentChildHierarchy].CURRENTMEMBER > [Measures].[EffectiveBelowLevel].
- 0 is used if the hierarchy level of [DimParentChild].[ParentChildHierarchy].CURRENTMEMBER <= [Measures].[EffectiveBelowLevel].
是否可以使用度量维度上的计算成员来实现此功能?
如果是,那么公式会是什么样子?
如果没有的话还有什么办法呢? 我对任何其他类型的解决方案也非常感兴趣(例如 mdx 查询等)
作为示例:
[Measures] [Value] [EffectiveBelowLevel] ParentChildAssociation 10 1 GrandChild1 20 2 GrandChild2
[DimParentChild].[ParentChildHierarchy] Member HierarchyLevel Description Parent 1 - Child 2 first child of Parent GrandChild1 3 first child of Child GrandChild2 3 second child of Child
使用此数据 [Measures].[EffectiveValue] 应该如下所示
ParentChild EffectiveValue Parent 0 Child 10 GrandChild1 10 GrandChild2 20
I have a cube which has
- two measure members:
[Measures].[Value]
(integer) and[Measures].[EffectiveBelowLevel]
(integer). - a dimension called [DimParentChild] with a ragged user hierarchy called
[ParentChildHierarchy]
.
I would like to create a calculated member on the measures dimension ([Measures].[EffectiveValue])
based on [Measures].[Value]
which when queried along [DimParentChild]
and [ParentChildHierarchy]
behaves as follows:
- [Measures].[Value] is used if the hierarchy level of [DimParentChild].[ParentChildHierarchy].CURRENTMEMBER > [Measures].[EffectiveBelowLevel].
- 0 is used if the hierarchy level of [DimParentChild].[ParentChildHierarchy].CURRENTMEMBER <= [Measures].[EffectiveBelowLevel].
Is it possible to achieve this functionaly with a calcuated member on the measures dimension?
If yes then what the formula would look like?
If not then what other way would there be?
I am very interested in any other kind of solution as well (e.g. an mdx query, etc.)
As an example:
[Measures] [Value] [EffectiveBelowLevel] ParentChildAssociation 10 1 GrandChild1 20 2 GrandChild2
[DimParentChild].[ParentChildHierarchy] Member HierarchyLevel Description Parent 1 - Child 2 first child of Parent GrandChild1 3 first child of Child GrandChild2 3 second child of Child
With this data [Measures].[EffectiveValue] should look like this
ParentChild EffectiveValue Parent 0 Child 10 GrandChild1 10 GrandChild2 20
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
类似的事情怎么样(我不确定级别序数是从 0 开始的):
您可以查看此 MDX 文档 此处了解更多详细信息。
How about something along the lines (I'm not sure about level ordinal being 0-based):
You can have a look to this MDX documentation here for more details.
我看到您也在这里发布了这个问题(最初是在 ssas msdn 论坛上看到的),所以我提供了我的答案的链接,因为它可能会帮助其他人。 SSAS msdn 论坛上的主题链接
@Marc - 由于这是父子维度的情况,并且 p/c 维度可以具有与非叶成员关联的数据,因此您的查询将不会返回正确的结果。我花了一些时间才弄清楚如何在这种情况下汇总儿童的正确结果,并建议您查看该链接。题外话:祝你的产品好运,我希望有一天我能有时间评估它:)
问候,
赫尔沃耶
I see you have posted this question here also (saw it originally on ssas msdn forum), so I am providing the link to my answer as it might help other people. thread link on SSAS msdn forum
@Marc - As this is a case of parent child dimension and p/c dimensions can have data associated on nonleaf members your query would not return the correct results. It took me some time to figure out how to aggregate the correct results from children in this case and recommend you have a look at the link. Offtopic: good luck with your product, I hope I'll get the time to evaulate it one day :)
Regards,
Hrvoje