How to conditionally sum a subtotal ?

Hi !

I've got this problem:

I want to conditionaly sum a subtotal that is a result of a value in a dataset.

I'm writing this:

=Sum(IIF(Fields!DGR.Value<0,Fields!SALDO.Value,0))

It gives me an error, but if I write like this

=Sum(IIF(Fields!DGR.Value<0,Felds!SALDO.Value,(Fields!SALDO.Value-Fields!SALDO.Value)))

If the value in the field DGR is below 0 than I want to calculate with the value in SALDO, otherwise I want it to be 0 so that the sum-function doesn't return Null.

I get no errors but since this is in a group in a dataset, it only works on the first group, the rest gives me the value of 0.

Any idea whats wrong ?

[707 byte] By [UlfLagerb] at [2007-12-19]

SQL Server

Site Classified