In my database cube, data is distributed like this, for each quarter, per year
2005 - > Q1 -> 10 2006 - > Q1 -> 4 2007 -> Q1-> 4
Q2 -> 20 Q2 -> 4 Q2-> 44
Q3 -> 5 Q3 -> 4 Q3-> 3
Q4 -> 4 Q4 -> 4 Q4-> 3
2006财政年度& 2007我需要从
获取数据2005 -> Q2,Q3,Q4 & Q1 of 2006 ie, 20, 5,4,4
2006 -> Q2,Q3,Q4 & Q1 of 2007 ie, 4,4,4,4
我已经构建了像这样的mdx查询 - :
WITH MEMBER [LTII_NIRS_E] AS
SUM({[DIM TIME].[YEAR - QUARTER - MONTH].[YEAR].[2005].[Q2]:[DIM TIME].[YEAR - QUARTER - MONTH].[YEAR].[2006].[Q1]},[Measures].[Measures].[LTII NIRS E])
SELECT [LTII_NIRS_E] ON COLUMNS, {[DIM TIME].[YEAR -
QUARTER - MONTH].[2006]:[DIM TIME].[YEAR - QUARTER - MONTH].[2008]}
On ROWS FROM [NH_INCID] WHERE [Business Component].[Region].[Novelis North America]
但它只提供了2005财年的数据
即,执行查询后结果如下所示
2006 -> 33
2007- > 33 -> it should give 16 instead of 33
我应该在上述查询的SUM函数中写什么,以便计算每个会计年度。请帮我解决这个问题?
答案 0 :(得分:3)
我使用滞后来告诉我在第一季度昏暗时间层次的指定年度成员的第一季度之前的三个季度。这是有效的,因为我在计算成员中使用currentmember,然后在行轴上指定成员。
WITH MEMBER [LTII_NIRS_E] AS
'Sum({[DIM TIME].[YEAR - QUARTER - MONTH].currentmember.firstchild.lag(3): [DIM TIME].[YEAR - QUARTER - MONTH].currentmember.firstchild}, [Measures].[LTII NIRS E])'
SELECT [LTII_NIRS_E] ON COLUMNS,
{ [DIM TIME].[YEAR - QUARTER - MONTH].[2006], [DIM TIME].[YEAR - QUARTER - MONTH].[2007], [DIM TIME].[YEAR - QUARTER - MONTH].[2008]} on ROWS
FROM [NH_INCID]
WHERE [Business Component].[Region].[Novelis North America]