我不知道如何设置这个,但是尝试使用MDX对度量值求和。
我的MDX如下:
select {[CompanyDimension].[Foo],
[CompanyDimension].[Bar],
[CompanyDimension].[CDK]} on columns,
TopCount([${SLRDimension}].Children,
10,
[Measures].[ProjectCountMeasure]) on rows
from [Foo_Cube]
where ([FAreaDimension].[Admin])
对于这个表达式,我得到以下输出:
+----------------------------------------------------------------------+
| | CompanyDimension.NameHierarchy |
+----------------------------------------------------------------------+
| SLRDimension | Foo | Bar | CDK
+----------------------------------------------------------------------+
| Development | 1 | 1 | 6
| Testing | | | 3
| Implementation | | 1 | 5
| Reports | 1 | | 4
| Planning | 1 | | 5
| Reporting | | | 1
| Coding | | | 2
| Performance | | | 1
| Designed | | 1 |
| Designing | | | 2
+----------------------------------------------------------------------+
现在我想获得每行的值总和。例如,在Development
的第一行中,我希望其对应的值为7
,而不是具有3个值,即1,1,6
我是MDX世界的新手,所以我不知道该怎么做。请帮忙!
我想要最终值如下:
+----------------------------------------------------------------------+
| | CompanyDimension.NameHierarchy |
+----------------------------------------------------------------------+
| SLRDimension | Sum
+----------------------------------------------------------------------+
| Development | 7
| Testing | 3
| Implementation | 6
| Reports | 5
| Planning | 6
| Reporting | 1
| Coding | 2
| Performance | 1
| Designed | 1
| Designing | 2
+----------------------------------------------------------------------+
答案 0 :(得分:1)
使用Pentaho样本数据SteelWheelsSales多维数据集作为基础,这与您现在的类似:
SELECT NON EMPTY {[Customers].[All Customers]} ON ROWS,
NON EMPTY {[Markets].[APAC],[Markets].[EMEA]} ON COLUMNS
FROM [SteelWheelsSales]
这就是你想要的:
SELECT NON EMPTY {[Customers].[All Customers]} ON ROWS,
NON EMPTY {[Measures].[Quantity]} ON COLUMNS
FROM [SteelWheelsSales]
WHERE {[Markets].[APAC],[Markets].[EMEA]}
注意我是如何使用我想要查看的度量替换列的,以及如何将市场移动到WHERE子句。