By a Decimal
(Number) datatype Nothing
and 0
are the same. You can test this.
Put a tablix into your report with year from 2017 to 2019. Then put the year in a column of the tablix as a number format, then write the following expression in the detail textbox:
=CDec(IIF(CDec(Fields!Year.Value) = 2017, 0, Nothing))
After executing your report you will notice that every value in the year column is 0
.
The same goes for the check. Both of these expressions will always return Yes
. I basically check for 0
and the second one for for Nothing
:
=IIF(CDec(IIF(CDec(Fields!Jahr.Value) = 2017, 0, Nothing)) = 0, "Yes", "No")
=IIF(CDec(IIF(CDec(Fields!Jahr.Value) = 2017, 0, Nothing)) = Nothing, "Yes", "No")
But remember your textbox/column has the be a number format.
So if you want to return Nothing
and you display it in a number format textbox, it will show you a 0
.
With this in mind it will make sense that a Count()
returns the value 1
for 0
AND Nothing
. So basically this will do the trick:
'Cont
=Sum(IIF(Fields!YourValue.Value = Nothing, 0, 1))