ParrellPeriod没有回复我的期望

时间:2015-09-16 14:10:05

标签: ssas mdx

我的年度销售目标名为“目标”,日期维度称为DimCalendar

查看基础数据,我认为我应该获得与以下查询返回的值不同的值。我的理解是,此查询将获得“目标”度量的值,其中关联年份为2016年(未来一年或-1)和特定帐户。

SELECT 
   {[Measures].[Target]} on columns,
   {ParallelPeriod(
      [DimCalendar].[Year].[Year]
     ,-1
     ,[DimCalendar].[Year].&[2015])} on rows
FROM [MySalesCube]
WHERE { [Account].[Account].&[2025] }

此查询返回

1944768

但是,基础数据似乎只加起来162064

不,看起来在使用立方体浏览器之后数据存在问题。必须重温我的ETL过程。

1 个答案:

答案 0 :(得分:0)

这是您指定的内容:

ParallelPeriod(
  [DimCalendar].[Year].[Year]
 ,-1
 ,[DimCalendar].[Year].&[2015])

这意味着以下内容:

Take the year 2015
Then jump the specified number of periods, in your case -1, using the level specified, in your case [Year]

以下应该(我认为)是一个简化但等效的版本 - 如果错过了第一个参数,那么它只使用第三个参数的级别:

ParallelPeriod(
  -1
 ,[DimCalendar].[Year].&[2015]) 

虽然我认为您可以使用lag来使所有内容更具可读性:

[DimCalendar].[Year].&[2015].LAG(-1)

然后再次使用1或-1内部延迟没有意义,因为我们有函数NEXTMEMBERprevMEMBER这可以简化为以下内容:

[DimCalendar].[Year].&[2015].NEXTMEMBER
相关问题