BestZz
BestZz

Reputation: 11

How to sum value with condition in ssrs

I am new about SSRS.

I made a report like in the picture and I want to sum values in the red circles into the blue circle.

The value in red circles is obtained summing the columns Debit or Credit + Brought Forward.

It might be Debit or Credit and this is an expression of balance debit:

=IIF((Fields!BFTotalBalance.Value >0) ,Sum(Fields!Debit.Value, "DepartmentCodeAndDes1")+ Fields!BFTotalBalance.Value,Sum(Fields!Debit.Value, "DepartmentCodeAndDes1"))

My problem is that I don't know how to sum total, because Brought Forward Balance (green cicle on the picture) can be both (Debit or Credit).

Please help me.

Upvotes: 0

Views: 925

Answers (1)

Alan Schofield
Alan Schofield

Reputation: 21703

This answer may need updating once I know more... To complete the answer I would need to know if the debit and credit values are stored in separate columns and if they are always positive or if debits are always stored as positive and credits are always stored negative.

Assuming that

  1. All values are signed (+ or -)
  2. BF values are signed
  3. Debit, credit and BF values are stored in separate columns

Then you can simply do something like.

e.g. Debit:

=SUM(Fields!BFTotalBalance.Value + Fields!Debit.Value)

If your debit and credits are not signed (they are always positive) then you just need to change the debit calc to be something like.

=SUM(Fields!BFTotalBalance.Value + (Fields!Debit.Value * -1))

If this expression is placed inside the group (whatever group 10929000 pertains to) then you should get the correct answer. If this doesn't work, let me know how the data is stored (show a small sample from your dataset).

Upvotes: 1

Related Questions