0

桌子:

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].Apples 在 Y = Strawberries 的情况下获胜,然后除以 [X].Strawberries 的总损失。[措施].[some_calculated_member] = 3 / (5 + 3)

另一种方法是这样计算: SUM([X].Apples wins where Y = Strawberries / SUM([Y].Strawberries wins)

我不确定如何构建 MDX 查询来完成我需要的内容:

SELECT
{ [Measures].[some_calculated_member] } ON 0,
{ [X].[Apples] } ON 1,
{ [X].[Strawberries] } ON 2,
{ [Y].[Strawberries] } ON 3
FROM [cube]

我已经研究过使用AXIS,但我使用的是不支持AXIS.

4

1 回答 1

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]
于 2013-10-26T20:11:28.623 回答