0

I'm trying to calculate the total of cost in RDLC report using expressions

I applied the following and it works fine :

=SUM(Val(Fields!PCOST.Value))

But I tried to apply another expression to calculate the cost but with a condition like below :

=IIf(Fields!Active.Value =False, SUM(Val(Fields!PCOST.Value)),0)

but only I got 0.00?

can anyone explain why?

the table [Active] field type is bit

enter image description here

ViKiNG
  • 1,294
  • 2
  • 19
  • 26

1 Answers1

1

You need to sum the result of the IIF rather than the other way round. I've not tested this but I think the following should work...

=SUM(IIf(Fields!Active.Value =False, Val(Fields!PCOST.Value),0))
Alan Schofield
  • 19,839
  • 3
  • 22
  • 35
  • Thanks a lot Mr. Alan, in fact after I reviewing my code I note that issue and fixed it, anyway I was sent an email to stackoverflow.com to delete this question before I receive any replay, but I'm surprised now how this question still. I hope that stackoverflow.com to add a deletion query button with a justification box to remove the question and to avoid any embarrassing situation like this – Mohammad Sufian Al-Omar Oct 22 '17 at 11:54