【问题标题】:SSAS using hierarchy without putting it in the selectSSAS 使用层次结构而不将其放入选择中
【发布时间】:2012-04-18 15:16:55
【问题描述】:

我们在时间维度中有一个层次结构,我们尝试使用维度的层次结构获取一些数据,但我们不想将层次结构放在 where 子句中。 这是代码:

with

member Measures.last_month as   
        sum(
        ParallelPeriod(
                [TIME].[Periods].[Level 06],1
        ), 
        [Ims Units])
select 

    {[Ims Units],last_month} on columns,
     [TIME].[Periods].[Level 06].members on rows
from [Analyzer cube]

它返回所有月份,具体来说:

2011 年 2 月:[ims units] 为 47271,last_month 为 51103

2011 年 3 月:[ims units] 为 55293,last_month 为 47271

但是如果我添加了 were 子句并删除了 select 子句中的层次结构:

with

member Measures.last_month as   
        sum(
        ParallelPeriod(
                [TIME].[Periods].[Level 06],1
        ), 
        [Ims Units])
select 
    {[Ims Units],last_month} on columns
from [Analyzer cube]
where [TIME].[MONTH NAME].&[201103 March]

它显示:

2011 年 3 月:[ims 单位] 为 55293,last_month 为空

我们在 last_month 有空值,因为它已被过滤时间维度。 有没有办法在不将层次结构放在 select 子句和 where 子句上并且仍然使用 parallelperiod 函数的情况下获得上个月? (ParallelPeriod的使用只是一个例子)

谢谢, 弗朗西斯科

【问题讨论】:

    标签: ssas olap


    【解决方案1】:

    如果您要在计算成员中引用时间维度,它需要上下文 - 这将来自您在行、列、WHERE 子句或您在计算表达式中明确指定的任何内容。没有其他方法可以让表达式知道它的起点是什么,以便计算并行周期,或任何确定相对于另一个时间点的时间点(出现在行、列或 WHERE 子句上)的函数。

    【讨论】:

      猜你喜欢
      • 2011-04-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多