gpt4 book ai didi

reporting-services - 用零替换空值

转载 作者:行者123 更新时间:2023-12-04 23:00:30 25 4
gpt4 key购买 nike

我知道这个问题之前已经被问过很多次了,但是按照以前的解决方案我仍然无法解决这个问题:

我有一个 SSRS (2008R2) 报告,它以矩阵形式显示数据。有一个包含可能存在或可能不存在的值的水平列组:当该值不存在时,我想用 0 替换空单元格。目前,报告呈现如下:

我希望那些空单元格中有 0
细胞表达设置为:

 =Sum(Fields!number.Value)

所以我试过了
 =iif (IsNothing(Sum(Fields!number.Value)),0,Sum(Fields!number.Value))


=iif (IsNothing(Fields!number.Value),0,Sum(Fields!number.Value))


=iif (Sum(Fields!number.Value)>0,Sum(Fields!number.Value),0)

...但“空”单元格仍然存在。我确定我在做一些愚蠢的事情……但是什么?

编辑: 为了更好地说明我的情况,我的查询产生类似于以下内容的输出(在 SSMS 中):
File | outcomeID     | number
A | Outcome1 | 2
A | Outcome2 | 1
B | Outcome2 | 2
C | Outcome1 | 1
D | Outcome3 | 2

...这将在 SSRS 中产生以下结果:
File | Outcome1 | Outcome2  | Outcome3
A | 2 | 1 |
B | 2 | |
C | 1 | |
D | | | 2

使用列组:


即使我将表达式更改为简单:
=999
我结束了
File | Outcome1 | Outcome2  | Outcome3
A | 999 | 999 |
B | 999 | |
C | 999 | |
D | | | 999

...即很多空格。

EDIT2: 我上传了一个非常小的示例 .rdl 文件 [REMOVED],使用上面的示例数据 - 它重现了问题

最佳答案

我的第一个想法是对存储过程进行更改,但是由于我有一个类似的报告可以快速测试某些内容,因此我有了一个想法。

试试这个

=0+Sum(Fields!number.Value)

关于reporting-services - 用零替换空值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26525674/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com