答案 0 :(得分:1)
好的,我找到了解决方案。 Tree过滤器的问题是它使用parentUnique名称来构建树。但这是我们可以欺骗的。
对于具有多个级别的时间层次,让我们使用年份和月份(没有季度)构建树。为此,我们可以使用此MDX
WITH
FUNCTION __currMember() AS [Date].[Date].hierarchy.currentmember
FUNCTION __defMember() AS {[Date].[Date].allmembers}(0).hierarchy.currentmember
FUNCTION __descendant(_c) AS Tail( Filter( Axis(1) as t, isAncestor(t.currentmember, _c )),1 )(0)
FUNCTION __unName(_c) AS IIF( _c is NULL, NULL, _c.uniqueName)
MEMBER ic3Name AS __currMember().name
MEMBER ic3UName AS __currMember().uniquename
MEMBER ic3PName AS __unName( __descendant(__currMember() ))
MEMBER ic3Measure AS 0
MEMBER ic3IsSelected AS false
MEMBER ic3FilterName as [Measures].[ic3Name]
MEMBER ic3Key as __currMember().key
SELECT
{[Measures].[ic3Name],[Measures].[ic3UName],[Measures].[ic3PName],[Measures].[ic3Measure],[Measures].[ic3IsSelected],[Measures].[ic3FilterName],[Measures].[ic3Key]} ON 0,
__defMember() + Hierarchize([Date].[Date].[Year] + [Date].[Date].[Month]) ON 1
FROM [Cube]
这是 descendant()函数正在做的伎俩。如果功能不符合您的需要,您可以更改功能,或者检查水平的东西太慢。注意,算法在轴上是O(N * N),它不是很好。但我认为它应该是通用的。
有了一点想象力和MDX,你可以做任何你喜欢的事情,就像建造我们正在使用测量的树一样(ON 0轴)。