Shoshotto
Shoshotto

Reputation: 93

Conditional Sum and Count in Crystal Reports

Is there any way that I can change a formula field with this code:

if(isnull(sum({col1}))) then
0
else
sum({col1})

to something like: sum(col1) WHERE col2='a'? I would like to calculate only some rows in the sum based on a value of another column.

In case there is, please provide me with syntax or the way to do it.

P.s: in case it matters I'm using CrystalReports 13.0 whith Visual Studio 2010

Upvotes: 0

Views: 2853

Answers (1)

Siva
Siva

Reputation: 9101

You can do something like this.

In details write formula

If col2='a'
Then col1
Else 0

Now take the sum in footer

Upvotes: 1

Related Questions