样本数据
我以以下格式导出了 OLAP 多维数据集(测量[Some Percent]
用法为Average over time
):
[Net Weight] [Some Percent]
4 387 2,10%
3 304 1,60%
Grand total: 7 691 1,85% -- Percent is AVG
公式
我需要创建新的计算成员[Modified Percent]
,该成员应按以下方式计算:
[Net Weight].[1] / [Net Weight].[Total] * [Some Percent].[1] +
[Net Weight].[2] / [Net Weight].[Total] * [Some Percent].[2] +
[Net Weight].[n] / [Net Weight].[Total] * [Some Percent].[n] -- can be n rows
带有样本数据的公式
所以我的样本数据将是:
4 387 / 7691 * 2,10 + | 1,20%
3 304 / 7691 * 1,60 | 0,69%
= | 1,89% -- Sum of percent
期望的输出
[Modified Percent]
应按以下方式返回:
[Net Weight] [Some Percent] [Modified Percent]
4 387 2,10% 1,20%
3 304 1,60% 0,69%
Grand total: 7 691 1,85% -- Percent is AVG 1,89%
MDX 脚本
现在我有MDX Script
以下,但[Modified Percent]
返回相同的值[Some Percent]
CREATE MEMBER CURRENTCUBE.[Measures].[Modified Percent]
AS ([Measures].[Net Weight] / sum([Vendor Invoice].[Vendor Invoice No].[All],[Measures].[Net Weight])) * [Measures].[Some Percent],
FORMAT_STRING = 'Percent',
NON_EMPTY_BEHAVIOR = { [Net Weight] },
VISIBLE = 1;
也试过这个,但不幸的是,同样的结果:
CREATE MEMBER CURRENTCUBE.[Measures].[Modified Percent]
AS ([Vendor Invoice].[Vendor Invoice No].CurrentMember,[Measures].[Net Weight]) /
iif(
([Vendor Invoice].[Vendor Invoice No].CurrentMember.Parent,[Measures].[Net Weight]) = 0,
([Vendor Invoice].[Vendor Invoice No].CurrentMember,[Measures].[Net Weight]),
([Vendor Invoice].[Vendor Invoice No].CurrentMember.Parent,[Measures].[Net Weight])
)
* [Measures].[Some Percent],
FORMAT_STRING = 'Percent',
NON_EMPTY_BEHAVIOR = { [Net Weight] },
VISIBLE = 1;
看起来像拆分部分返回 1。你有什么想法如何解决它吗?如果有什么不清楚的地方——问我,我会提供更多细节。