psk
psk

Reputation: 15

finding sum of values from a single column in Crystal reports

I have a column in crystal reports named flag. it has values of both 0's and 1's. what is the best way to find out the sum of all the zeroes and sum of all the ones separately from a single column.

Also I need to find the number of values in a particular column.(here zeroes and ones)?

Upvotes: 0

Views: 1069

Answers (1)

kishore V M
kishore V M

Reputation: 811

you can get this by having two Formula fields,

  1. formulafield1 Here you will write the logic like if flagfield is zero then 1 else 0. Sample syntax

IF {Table.flag} = 0 THEN 1 ELSE 0;

  1. Formulafield2 you will write the opposite condition here if flagfield is 1 then 1 else 0. (in your example you can use directly flag value it self)

now

sum(formulafield1)

will give number of zeros and

sum(Formulafield2)

will give number of ones

Please note i have used crystal reports long back .. please check syntax once .. :)

Upvotes: 1

Related Questions