Print Page | Close Window

Count Specific Value

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22581
Printed Date: 23 Apr 2024 at 2:02am


Topic: Count Specific Value
Posted By: fuller31
Subject: Count Specific Value
Date Posted: 23 Apr 2018 at 5:59am
In my report, I need to total how many times per each code the codes VER, WW, and UTC have been used in the field lwmain.ccode. I need these values to reset for each group. I've been trying formulas and running totals for hours and cannot get it to work properly. Can anyone help? Thank you!



Replies:
Posted By: DBlank
Date Posted: 23 Apr 2018 at 6:25am
you can create 3 running totals (RT) or, depending on if you can display the other values just use a cross-tab in the group footer

RT example.
Right click on Running Total
select New
Name = VERcount
Field to Summarize = can be just about anything but best if it is the primary Key of the report (like a transactionid)
Type OF summary = Count (or a distinct Count if you have dupes you are trying to avoid)
Evaluate = Use a formula
lwmain.ccode = 'VER'
Reset = On change of group (select your group)
Place the RT in the group footer, it will not work in a group header
Repeat for the other two items but change the evaluation criteria (formula)


Posted By: fuller31
Date Posted: 23 Apr 2018 at 6:32am
I apparently wasn't using my brain, but have figured it out.

Formula for each code:
if {lwmain.ccode}="code"
then 1
else 0

Make a summary, and sum each formula.



Print Page | Close Window