1

我们正在一家物流服务提供商处实施 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])
4

2 回答 2

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])
于 2012-10-09T14:44:33.400 回答
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')
于 2012-10-09T14:45:52.290 回答