3

我是 mdx sintaxys 的新手。

我有下一个要求,如果可能的话,我需要能够使用 mdx 解决它。我需要显示金额大于“X”的销售交易数量,金额小于“Y”的销售交易数量,金额大于“Z”的信用交易数量。等等。我的多维数据集有一个名为“amount”的度量,具有聚合函数“sum”和 transactionNumber,具有聚合函数“count”和时间维度、transactionType 维度等。

问题是,X、Y 和 Z 是动态值并由用户配置,我需要读取这些值,构建查询并通过 xmla 执行它。

我正在等待一个结果集作为下一个

                  Greater than > 200 USD       less than < 0.10       total

          SALE            150                         10               300
          CREDIT          200                         30               600
          VODI            10                           2                60

您可以为我提供的任何帮助,我将不胜感激

4

1 回答 1

3

这只有在您拥有事务级别的属性时才有可能,否则您的度量将被预先聚合到更高级别。

如果您确实有类似 [Transaction ID] 属性的内容,则可以编写如下查询。

WITH 
  MEMBER Measures.[Greater than 200 USD] as 
    SUM(Filter([Transaction ID].[Transaction ID].[Transaction ID], Measures.Amount > 200)
       , Measures.Count)
  MEMBER Measures.[Less than 0.10 USD] as 
    SUM(Filter([Transaction ID].[Transaction ID].[Transaction ID], Measures.Amount > 200)
       , Measures.Count)
  MEMBER Measures.Total as Measures.Count
SELECT
  {Measures.[Greater than 200 USD]
    ,Measures.[Less than 0.10 USD]
    ,Measures.[Total]} ON columns
 , [Transaction Type].[Transaction Type].[Transaction Type] ON Rows
FROM <Cube>
于 2010-03-09T03:20:22.587 回答