Sum with Condition

Stimulsoft Reports.NET discussion
Post Reply
Saro
Posts: 7
Joined: Wed Feb 18, 2009 7:28 am
Location: India

Sum with Condition

Post by Saro »

Hi,

I want to show the summary of a field (Amount), based on another field (Type).

For ex:

No Type Amount (Header)
--- ------ ----------
1 A 23.00 (Details)
2 B 14.00
3 A 12.00
4 B 42.00
5 C 25.00
_________________

Sum of A 35.00 (Footer)
Sum of B 56.00
Sum of C 25.00



Image



I was trying to use cSumIf(Band,Expression,Condition) as

cSumIf(Databand1, Amount, Type="A")
cSumIf(Databand1, Amount, Type="B")
cSumIf(Databand1, Amount, Type="C")

But it shows zero when the Expression field and Condition field are different. It allows me to use the same field in both Expression and Condition.

Can someone guide me to achieve this.

Thank you,
Saro
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Sum with Condition

Post by Edward »

Hi Saro,

The easiest possible way is to use "Data from other Data Source" DataSource. In that new datasource you could group the data as required and add aggregate columns functions which would calculate 'Sum of A', 'Sum of B', etc.

Thank you.
Post Reply