英文:
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))
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论