2010-02-17 38 views
0

我在Analysis Services中设置了一个新的多维数据集,并使用商业智能向导来计算货币换算问题。现在,这一切都可以完美运行,货币会在叶级转换并汇总显示在用户选择的报告货币中。如何覆盖SSAS商业智能“货币换算”以计算责任

我现在的问题是责任的计算。对于责任,我需要总结每种货币的货币,然后使用最近的“日收盘价”进行转换。我有节率结束“作为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]措施,但为避免货币转换而采取额外措施似乎很浪费 - 此外,在真实立方体中,还有几个措施需要计算,因此它不仅仅是额外的一。

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

回答

1

行,所以我结束了创建一个无形的[措施] [钱 - 责任]这是不是自动转换通过上面的代码,我结束了在脚本以下计算:

[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])) 
);