【发布时间】:2013-07-04 16:48:08
【问题描述】:
SQL Server 2012
Visual Studio 2010
Dataset being used is called Performance
Formulas
ACB = Average Capital Base
IRR = Internal Rate of return = Total Gain/ACB
Contribution = ACB/Sum(ACB)*IRR
我正在尝试计算投资贡献。 这是一个示例计算。
Account Total Gain ACB IRR Contribution
ABC 2,000.00 20,000 10% 6.67%
DEF 2,000.00 10,000 20% 6.67%
total 4,000.00 30,000 13.33% 13.33%
Total IRR 和 Total Contribution 总是相等的
请注意,贡献是单行 ACB 乘以 ACB 的总和,然后乘以单行 IRR。
我有以下报告。我的问题是由于嵌套聚合,我无法进行小计和总计。我也不确定如何定位正确的数据范围。
IRR 和 IRR 小计表达式(工作)
=Fields!TotalGain.Value/Fields!ACB.Value
=Sum(Fields!TotalGain.Value)/Sum(Fields!ACB.Value)
试图让 Contribution 计算起作用(得出错误的数字)
=Fields!ACB.Value/Sum(Fields!ACB.Value, "Performance")*Fields!IRR.Value
试图得到贡献的小计和总和(尽管数字是错误的)
=sum(Fields!ACB.Value/Sum(Fields!ACB.Value, "Performance")*Fields!IRR.Value)
我收到此错误
Error 3 [rsInvalidNestedDataSetAggregate] The Value expression for the text box ‘Textbox29’ has a nested aggregate that specifies a dataset scope. Inner aggregates cannot specify a dataset scope. F:\Automater\SSRS\Reports_2012\PerformanceSample2.rdl 0 0
我意识到错误与尝试对已求和的值求和有关,但这是计算所要求的。
【问题讨论】:
标签: reporting-services dataset aggregate-functions