如何覆盖SSAS商业智能的“货币转换”以进行责任计算

时间:2010-02-17 09:02:14

标签: mdx ssas

我在Analysis Services中设置了一个新的多维数据集,并使用商业智能向导来计算货币转换问题。现在这一切都完美无缺,货币在叶级转换,并汇总显示在用户选择的报告货币中。

我现在的问题是责任的计算。对于责任,我需要总结每种货币的货币,然后使用最新的“日终费率”进行转换。我将“End of Day Rate”作为LastNonEmpty度量,但我看不出如何避免叶级转换,如下所示:

// This is the Many to One section  
// All currency conversion formulas are calculated for the pivot currency and at leaf of the time dimension 
Scope ({ Measures.[Money] } ); 
  Scope( Leaves([Date]) ,[Reporting Currency].[GBP], Leaves([Currency])); 

    // Convert Local value into Pivot currency for selected Measures that must be         converted with Measure rate [End Of Day Rate] 
        Scope( { Measures.[Money] } )
            This = [Reporting Currency].[Local] * Measures.[End Of Day Rate]; 
        End Scope; 
  End Scope;    

  // This is the One to Many section
  // All currency conversion formulas are calculated for the non pivot currency and at leaf of the time dimension   
  Scope( Leaves([Date]) , Except([Reporting Currency].[Currency].[Currency].Members, {[Reporting Currency].[Currency].[Currency].[GBP], [Reporting Currency].[Currency].[Currency].[Local]})); 

    // This section overrides the local values with the Converted value for each selected measures needing to be converted with Measure rate [End Of Day Rate]… 
    // LinkMember is used to reference the currency from the source currency dimension in the rate cube. 
    Scope( { Measures.[Money] } ); 
        This = [Reporting Currency].[Currency].[GBP] / (Measures.[End Of Day Rate], LinkMember([Reporting Currency].[Currency].CurrentMember, [Currency].[Currency])); 
    End Scope;

  End Scope;  // Leaves of time, all reporting currencies but local and pivot currency  
End Scope;  // Measures

[Money]指标以不同货币支付,每种货币都以货币维度和“日终费率”键入。

计算责任的最佳计划是什么?我正在考虑复制[Money]措施,但为了避免货币转换而采取额外措施似乎很浪费 - 另外在真正的立方体中还有几个需要计算的措施,所以它不仅仅是额外的之一。

其他人遇到过类似的事情吗?

1 个答案:

答案 0 :(得分:1)

好的,所以我最终创建了一个不可见的[Measures]。[Money - Liability],它没有被上面的代码自动转换,我最终在脚本中进行了以下计算:

[Measures].[Liability] = 
(
    SUM 
    ( [Currency].[Currency].[Currency], 
        SUM 
        ( 
            { NULL : [Date].[Date Key].CurrentMember }, 
           (   
                [Money - Liability]
            )
      ) 
      / [Measures].[End Of Day Rate] 
    ) 
    * (Measures.[End Of Day Rate], LinkMember([Reporting Currency].[Currency].CurrentMember, [Currency].[Currency]))
);