表:
X Y wins losses
Apples Oranges 5 2
Apples Limes 2 1
Apples Strawberries 3 3
Limes Pears 5 4
Limes Strawberries 6 8
Strawberries Limes 2 3
Strawberries Apples 1 5
我需要总结[X]。苹果赢得Y =草莓,并将其除以[X] .Strawberries总损失。 [措施]。[some_calculated_member] = 3 /(5 + 3)
另一种方法是以这种方式计算: SUM([X]。苹果赢得Y =草莓/ SUM([Y] .Strawberries胜利)
我不确定如何构建MDX查询以实现我的需求:
SELECT
{ [Measures].[some_calculated_member] } ON 0,
{ [X].[Apples] } ON 1,
{ [X].[Strawberries] } ON 2,
{ [Y].[Strawberries] } ON 3
FROM [cube]
我已经研究过使用AXIS
,但我使用的是Mondrian,它不支持AXIS
。
答案 0 :(得分:1)
您是否尝试过计算出来的措施?
WITH
Member [Measures].[Ratio] AS (
[Measures].[wins.SUM],
[X].[ALL].[AllMember].[Apples],
[Y].[ALL].[AllMember].[Strawberries]
) / (
[Measures].[losses.SUM],
[Y].[ALL].[AllMember].[Strawberries]
)
SELECT NON EMPTY {
[Measures].[New Measure]
} ON COLUMNS
FROM [SomeCube]