Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi all,

Could someone provide a method to make conditional sum on each row of a table in rdlc bound to a dataset. Here's the code I'm currently using in the expression:

=Fields!InitialAmount.Value + SUM(IIf(Fields!RowNumber.Value<=Fields!RowNumber.Value, Fields!TotalPrice.Value, 0), "ClientBalanceSheetDataSet") - SUM(IIf(Fields!RowNumber.Value<=Fields!RowNumber.Value, Fields!Amount.Value, 0), "ClientBalanceSheetDataSet")
Posted
Updated 27-Jul-18 2:35am
Comments
Matej Hlatky 6-Feb-13 9:30am    
And where is the problem?
You are using good approach with nested Iif. If you have problem with SUMming values, try to use "0D" instead of "0", when working with decimals ("money" data type).
AR1988 8-Feb-13 4:12am    
Tried this didn't work #Error is shown in the field. Is there a way to debug this function in rdlc reports?

1 solution

Exactly the kind of code i needed, conditional sum :D
It gave me an '#Error' too though, but I figured it out.

The 'IIf' does not return a type that can be summed, it needs to be converted.
I used decimals.
SUM(CDec(IIf(....)))
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900