我正在尝试将某种计算项目(等同于Excel)添加到我根据数据集创建的Tablix中。
例如
Type Today Month Annual
Sales 1,000 15,000 35,000
GP 200 1,500 5,000
我想在下面添加一行,该行将计算保证金百分比并且也是动态的,因此当数字更改时,保证金百分比也会更改
例如
Type Today Month Annual
Sales 1,000 15,000 35,000
GP 200 1,500 5,000
Margin % 20% 10% 14.3%
答案 0 :(得分:0)
如果在页脚中,则可以有条件地对字段Type
求和,例如对于Today
列:
=SUM(IIF(Fields!Type.Value = "GP", Fields!Today.Value, Nothing)) / SUM(IIF(Fields!Type.Value = "Sales", Fields!Today.Value, Nothing))
当然,如果Sales可以为零,那么您将得到除以零的错误,因此您需要使表达式变得比IIF
函数参数的bypass the error-generating divide-by-zero calculation更加复杂:>
=IIF(SUM(IIF(Fields!Type.Value = "Sales", Fields!Today.Value, 0.0)) <> 0.0,
SUM(IIF(Fields!Type.Value = "GP", Fields!Today.Value, Nothing)) / IIF(SUM(IIF(Fields!Type.Value = "Sales", Fields!Today.Value, 0.0)) = 0.0, 1.0, SUM(IIF(Fields!Type.Value = "Sales", Fields!Today.Value, Nothing))),
Nothing)