Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Replacing empty values with zeros

I know this question has been asked many times before, but having followed previous solutions I still can't resolve the issue:

I have a SSRS (2008R2) report, that displays data in a matrix. There is a horizontal column group containing values that may or may not exist: when the value doesn't exist, I'd like to replace the empty cell with a 0. Currently the report renders like:

enter image description here

and I'd like those empty cells to have 0's in them instead. The cell expression was set to:

 =Sum(Fields!number.Value)

so I tried

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

and

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

and

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

... but the "empty" cells persist. I'm sure I'm doing something daft... but what?

EDIT: To illustrate my situation better, my query produces output (in SSMS) similar to:

File | outcomeID     | number
A    |    Outcome1   |   2
A    |    Outcome2   |   1
B    |    Outcome2   |   2
C    |    Outcome1   |   1
D    |    Outcome3   |   2

... which would produce the outcome in SSRS of:

File | Outcome1 | Outcome2  | Outcome3
 A   |    2     |     1     |
 B   |    2     |           |
 C   |    1     |           |
 D   |          |           |    2

using a Column Group:

enter image description hereenter image description here

Even if I change the expression to be simply:

=999

I end up with

File | Outcome1 | Outcome2  | Outcome3
 A   |    999   |     999   |
 B   |    999   |           |
 C   |    999   |           |
 D   |          |           |    999

... i.e. lots of blank spaces.

EDIT2: I've uploaded a very small example .rdl file [REMOVED], using the example data above - it reproduces the issue

like image 428
KenD Avatar asked Dec 20 '22 10:12

KenD


1 Answers

my first thought was a change to the stored procedure but since i had a similar report to test something on quickly i had an idea.

try this instead

=0+Sum(Fields!number.Value)
like image 167
pancho018 Avatar answered Jan 25 '23 12:01

pancho018