我们正在物流服务提供商处实施ActivePivot,我们希望构建一个视图,以帮助我们找出速度不够快的货件,并帮助我们了解如何改进此KPI。我们有一个简单的MDX视图,显示了几天内的老化库存以及客户的发货数量。
是否有一种简单的方法来计算每个客户的出货量加权的老化库存?有没有办法计算这个加权平均值,无论用于分析这个度量的维度是什么?
以下是我们使用的MDX查询:
WITH
MEMBER [Measures].[Mean Storage Time] AS
([Measures].[Nb.DayPrestation.Started-Finished].Value / [Measures].[Nb.Prestation.Started-Finished].Value)
SELECT
NON EMPTY Order(Hierarchize({DrilldownLevel({[V_MODEL].[ALL].[AllMember]})}), ([Measures].[Mean Storage Time]), DESC) ON ROWS,
NON EMPTY {[Measures].[Mean Storage Time], [Measures].[NbP.PBK]} ON COLUMNS
FROM [OperationPrestationCube]
WHERE ([V_DESTINATION].[ALL].[AllMember], [P_STOCKAGE].[ALL].[AllMember].[true])
答案 0 :(得分:1)
以下MDX添加“加权平均存储空间”,等于“平均存储时间”加权“NbP.PBK”
WITH
MEMBER [Measures].[Weighted Mean Storage] AS
Iif(([V_MODEL].CurrentMember.Level.Ordinal = 0), [Measures].[Mean Storage Time], Iif(IsEmpty([Measures].[Mean Storage Time]), NULL,(([Measures].[Mean Storage Time] * [Measures].[NbP.PBK]) / ([V_MODEL].DefaultMember, [Measures].[NbP.PBK]))))
MEMBER [Measures].[Mean Storage Time] AS
([Measures].[Nb.DayPrestation.Started-Finished].Value / [Measures].[Nb.Prestation.Started-Finished].Value)
SELECT
NON EMPTY Order(Hierarchize({DrilldownLevel({[V_MODEL].[ALL].[AllMember]})}), ([Measures].[Mean Storage Time]), DESC) ON ROWS,
NON EMPTY {[Measures].[Mean Storage Time], [Measures].[NbP.PBK], [Measures].[Weighted Mean Storage]} ON COLUMNS
FROM [OperationPrestationCube]
WHERE ([V_DESTINATION].[ALL].[AllMember], [P_STOCKAGE].[ALL].[AllMember].[true])
答案 1 :(得分:0)
您可以使用如下表达式计算加权平均值:
Sum('set on which you want to do weighted avg', 'your measure' * 'the weight') / Sum('set on which you want to do weighted avg', 'the weight')