我有一个具有以下三个维度的多维数据集:日期、时间和班次。我有一个名为 [Pieces Succeeded] 的度量,我想要一个 Shift 小时的 [Pieces Succeeded] 的运行总数。班次可以跨越一天以上,因此在以下查询中,我对日期和时间维度进行了交叉连接。
with
member [Measures].[Pieces Succeeded Running Total] as
sum([Time].[Hierarchy].[Hour].FirstMember:[Time].[Hour].CurrentMember, [Measures].[Pieces Succeeded])
select
{ [Measures].[Pieces Succeeded], [Measures].[Pieces Succeeded Running Total] } on columns,
nonempty(crossjoin([Date].[Month Hierarchy].[Day].Members, [Time].[Hierarchy].[Hour].Members)) on rows
from
[OEE]
where
[Shift].[Month Hierarchy].[Shift].&[501]
这给出了以下结果:
Date Hour Pieces Succeeded Pieces Succeeded Running Total
03 Apr 2011 22 6393 6393
03 Apr 2011 23 6424 12817
04 Apr 2011 00 3816 3816
04 Apr 2011 01 5510 9326
04 Apr 2011 02 2090 11416
04 Apr 2011 03 7489 18905
04 Apr 2011 04 7307 26212
04 Apr 2011 05 5706 31918
我将如何让总和在交叉连接集上工作,以便运行总计可以跨天工作?
谢谢