SSRS报表生成器求和并排除一个

huangapple go评论63阅读模式
英文:

SSRS report builder sum all and exclude one

问题

我有税收列,并且在底部我想要所有行的总和。
在我的情况下,我想要将一个产品排除在外。
下面是所需的结果('C'已被排除)

  | 行  | 税收  |
  | ----| -----|
  | A   | 20   |
  | B   | 30   |
  | C   | 10   |

|总计 | 50 |

英文:

I HAVE TAX COLUMN AND AT THE BOTTOM I WANT TO HAVE THE SUM OF ALL ROWS.
IN MY CASE I WANT TO EXCLUDE ONE PRODUCT FROM IT
BELOW IS THE RESULT THAT IS NEED ('C' IS EXCLUDED)

  | ROW | TAX  |
  | ----| -----|
  | A   | 20   |
  | B   | 30   |
  | C   | 10   |

|SUM | 50 |

答案1

得分: 1

一个IIF可以在聚合函数内部使用,以在ROW为C时将TAX的值替换为零。

=SUM(IIF(Fields!ROW.Value = "C", 0, Fields!TAX.Value))

如果TAX字段不是整数,则可能需要将0包装在CDEC函数中以将其转换为小数。

=SUM(IIF(Fields!ROW.Value = "C", CDEC(0), Fields!TAX.Value))

英文:

An IIF can be used inside the aggregate function to replace the value of TAX with zero if ROW is C.

=SUM(IIF(Fields!ROW.Value = "C", 0, Fields!TAX.Value))

If the TAX field is not an INTEGER, then you may need to wrap the 0 in a CDEC function to convert it to decimal.

=SUM(IIF(Fields!ROW.Value = "C", CDEC(0), Fields!TAX.Value))

huangapple
  • 本文由 发表于 2023年7月17日 21:26:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/76704946.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定