Link to home
Start Free TrialLog in
Avatar of Gary Demos
Gary DemosFlag for United States of America

asked on

Creating a formula for a conditional count on two unique values in Crystal Reports

I'm using the following formula successfully with a summary (count) on that formula to count unique values in a field:
if {table.field} = 1   then '1'    else '0'

I'm now trying to count two unique values and cannot get the summary count to work:
if {table.field} = 1 OR  {table.field} = 2  then '1'    else '0'

It does not combine the two values in the count.
Avatar of Pawan Kumar
Pawan Kumar
Flag of India image

Is your count coming incorrect?
Avatar of Gary Demos

ASKER

Oh it is working after I changed the ELSE {@NULL} and did a COUNT instead of DISTINCT COUNT in the summary. Sorry for the  confusion!
SOLUTION
Avatar of Pawan Kumar
Pawan Kumar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That's a clever idea!
Avatar of Mike McCracken
Mike McCracken

No need to worry about distinct count or the '0' values being counted.

mlmcc
Great help