简体   繁体   中英

SSRS Calculated field problem

I'm trying to add a calculated field in a dataset with the following formula:

=iif(Fields!Stocabil.Value,Fields!ValoareFacturat.Value,0)

but using this formula, I'm not getting 0 values on false condition (Stocabil field is boolean), it's returning null probably. I found a workaround that resolve my problem but I really don't like it. The workaround is to replace 0 with a math calculation between fields that will always be 0.

=iif(Fields!Stocabil.Value,Fields!ValoareFacturat.Value,Fields!ValoareFacturat.Value-Fields!ValoareFacturat.Value)

Is there an explanation for this? Thank you

As I said, I can't reproduce your problem, and I can't see why what you've done shouldn't work. As discussed in the comments, though, a workaround is to use CDbl() , which will force the value to a double, and should display a zero for you.

=iif(IIF(IsNothing(Fields!Stocabil.Value),False,Fields!Stocabil.Value),Fields!ValoareFacturat.Value,0)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM