jangtrektang
jangtrektang

Reputation: 17

count certain values of a field in Crystal Reports

I'm fairly new to Crystal Reports, so maybe this is pretty basic but here goes..

I have a field where the value can be Y or N. At the bottom of my report I want to show the amount of Y of this field from the above records.

Example:

Name      Field 1 
=====     ========
pers1     Y
pers2     N
pers3     Y
TOTAL     2

Anyone has a clue how to get this done? Many Thanks for your time!

Upvotes: 0

Views: 3880

Answers (3)

craig
craig

Reputation: 26272

Create a formula field:

// {@Has_Y}
If {table.Field 1}="Y" Then 1 Else 0

Add a summarized field:

  • Insert > Summary...
  • Substitute {@Has_Y} forLast Year's Sales'

enter image description here

Note: If it makes it easier, you can add {@Has_Y} to the details section, but it isn't required for the summarized field to work correctly.

Upvotes: 0

Siva
Siva

Reputation: 9101

My approach woule be:

  1. Create a formula @Caclculate and write below code.

    if Field1='Y'
    then 1
    else 0
    

Place the formula adjacent to Field 1 and supress.

2 . Now take the sum of the @Calculate and place it in footer.

Take sum by Right Click field calculate-->Insert --> summary

Edit----------------------------------------------------------------------------------

one more apporach.. try this:

you can use running total.

  1. In field to summarize take Field1 and take count as option to summarize.

  2. In evaluate use option formula, In that write below condition.

    if(Field1='Y')
    then true
    else false
    
  3. In reset use option never.

Upvotes: 1

Ajay2707
Ajay2707

Reputation: 5808

Your "Y" and "Parse" is seprate column ? I think separate in your question, so simply use Running total as descrive link or you can use summarize field.

put a running total field and sum of this.

http://victoriayudin.com/2009/11/25/running-totals-in-crystal-reports/

http://crystalreportsblog.com/crystal-reports-running-totals/

Upvotes: 0

Related Questions