亲爱的:
我有以下MDX查询。
WITH
MEMBER [Measures].[Member Full Path] AS
[Revenuedim_Client].CurrentMember.UniqueName
MEMBER [Measures].[Member Ordinal] AS
[Revenuedim_Client].CurrentMember.Ordinal
SELECT
NON EMPTY
Hierarchize(
Union(
Crossjoin( [Measures].[BeaconAmount_USD] ,
LastPeriods(12,[Date.YQM].lastChild.lastChild.lastChild)
)
,
Crossjoin({[Measures].[Member Ordinal], [Measures].[Member Full Path]},[Date.YQM].[2018])
)
,POST) ON COLUMNS,
TOGGLEDRILLSTATE(
TOGGLEDRILLSTATE(
TOGGLEDRILLSTATE(
TOGGLEDRILLSTATE(
{[Revenuedim_Client].[All Clients] } ,
{[Revenuedim_Client].[All Clients] }
)
, {[Revenuedim_Client].[Group Client - Altria Group Inc.] }
), {}
), {}
) ON ROWS from [Revenue_Client]
这给我一个输出如下:
在行上:客户端(有4个级别可向下钻取到项目级别) 在列上:12个月+具有完整成员路径的列 在单元格中:收入
查询的方式或位置可以添加ORDER语句,以便根据12个月的总收入和大多数收入太少的收入对行进行排序,这对于Revenuedim_client层次结构中的每4个级别都是如此吗
答案 0 :(得分:0)
我认为让事情更清楚一点,将12个月设置为WITH子句 - 然后添加聚合它的成员 - 然后使用由这个新成员组成的元组以及收入作为ORDER函数的数字参数。
WITH
MEMBER [Measures].[Member Full Path] AS
[Revenuedim_Client].CurrentMember.UniqueName
MEMBER [Measures].[Member Ordinal] AS
[Revenuedim_Client].CurrentMember.Ordinal
SET [12mth] AS
LastPeriods
(12
,[Date.YQM].LastChild.LastChild.LastChild
)
MEMBER [Date.YQM].[All].[12mth_Agg] AS
Aggregate([12mth])
SELECT
NON EMPTY
Hierarchize
(
Union
(
CrossJoin
(
[Measures].[BeaconAmount_USD]
,[12mth]
)
,CrossJoin
(
{
[Measures].[Member Ordinal]
,[Measures].[Member Full Path]
}
,[Date.YQM].[2018]
)
)
,POST
) ON COLUMNS
,Order
(
ToggleDrillState
(
ToggleDrillState
(
ToggleDrillState
(
ToggleDrillState
(
{[Revenuedim_Client].[All Clients]}
,{[Revenuedim_Client].[All Clients]}
)
,{[Revenuedim_Client].[Group Client - Altria Group Inc.]}
)
,{}
)
,{}
)
,[Date.YQM].[All].[12mth_Agg] //<<think I prefer to explicitly add what I'm ordering by
,DESC
) ON ROWS
FROM [Revenue_Client];