【问题标题】:How can I calculate Full Year in MDX in SSAS如何在 SSAS 中计算 MDX 的全年
【发布时间】:2015-05-12 15:12:37
【问题描述】:

我正在使用内置时间智能功能,我想计算全年的度量值。
例如,如果日期的当前成员是 2015/03/01;我想要从 2015/01/01 到 2015/12/31 的计算量度。

CREATE MEMBER CurrentCube.[DimTime].[FY-FQ-FM DimTime Calculations].[Full Year] AS "NA" ; 
( 
  [DimTime].[FY-FQ-FM DimTime Calculations].[Year to Date]
, [DimTime].[Fiscal Year].[Fiscal Year].Members
, [DimTime].[Date].Members
, { [Measures].[Forecasts], [Measures].[Budget] } 
) 
= Aggregate( 
   { [DimTime].[FY-FQ-FM DimTime Calculations].[Current DimTime] } 
     * PeriodsToDate( 
         [DimTime].[FY-FQ-FM].[Fiscal Year]
       , [DimTime].[FY-FQ-FM].CurrentMember
       ) 
   ) ;

【问题讨论】:

  • 您的日期/时间维度结构是什么样的?您在维度内是否有一个多层次的用户层次结构?
  • 您想将此计算添加到cube script 中还是只是想将其包含在一个临时 mdx 脚本中?
  • 感谢您的关注。我的日期维度是常规 SSAS 时间维度,包括会计期间层次结构,就像正常的季度日历层次结构一样。我想要立方体计算的全年计算部分;例如如下:@whytheq
  • 创建成员 CurrentCube.[DimTime].[FY-FQ-FM DimTime Calculations].[Full Year] As "NA" ; ( [DimTime].[FY-FQ-FM DimTime Calculations].[Year to Date], [DimTime].[Fiscal Year].[Fiscal Year].Members, [DimTime].[Date].Members, { [Measures ].[Forecasts], [Measures].[Budget] } ) = Aggregate( { [DimTime].[FY-FQ-FM DimTime Calculations].[Current DimTime] } * PeriodsToDate( [DimTime].[FY-FQ- FM].[财政年度], [DimTime].[FY-FQ-FM].CurrentMember ) ) ;
  • @thebeginner,上面提到的计算既不是cube calculation的正确语法,也不是ad hoc MDX query,你能检查一下并把它用正确的语法吗?还请使用措施ForecastsBudget 解释您对最终结果的期望。您是否期望从当年的第一天到当前日期的汇总值?

标签: ssas mdx


【解决方案1】:

感谢@whytheq 和@AkshayRane 的帮助。 我可以使用下面的方法完成全年。

(
    [DimTime].[FY-FQ-FM DimTime Calculations].[Full Year],
    [DimTime].[Fiscal Year].[Fiscal Year].Members,
    [DimTime].[Date].Members,
    {
      [Measures].[Forecasts],
      [Measures].[Budget]
    }

)


=

  Aggregate(
             { [DimTime].[FY-FQ-FM DimTime Calculations].[Current DimTime] } 
             *

            PeriodsToDate(
                            [DimTime].[FY-FQ-FM].[Fiscal Year],
                           (
                            ANCESTOR(  
                                      [DimTime].[FY-FQ-FM].CURRENTMEMBER,
                                      [DimTime].[FY-FQ-FM].[Fiscal Year] 
                                    )
                           )
                        )
          )

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多