Manjuboyz
Manjuboyz

Reputation: 7066

How to get the COUNT of rows in Crystal Report

I have a data in database which gives me 8 rows based on date range out of which 5 are HCT, is there any formula in crystal report where I can get that count of those 'Abbr' ?

I am comparing HCT text from Dynamic report selection, I need to know can we create a variable which gives us count of 'Abbr'. like for

  1. HCT should return 5
  2. US should return 2
  3. RN should return 1 value.

enter image description here

UPDATE 1:

Here is what I am trying to do. I have secondary selection criteria as Dynamic report along with date range. enter image description here

in the above example I have selected only "HCT", now even though sql data is returning 8 rows (HCT,US,RN) I need only the HCT count i.e. 5.

enter image description here If I select "HCT" and "US" in the secondary criteria then I should get count of both HCT and US i.e. 5 + 2 = 7. if I am not selecting anything then it should return 0, so irrespective of the data from DB, the value should be summed based on selection of my criteria.

am I clear enough?

Upvotes: 1

Views: 3496

Answers (2)

Manjuboyz
Manjuboyz

Reputation: 7066

I found the solution for my question, I am just putting it here so that someone may help for the above mentioned formula.

This is what I did

Created a Formula(not running totals) by name SumOfSkills

if({Command.GlobalSkillAbbr} in {?GlobalSkill}) then 1 else 0

here Command.GlobalSkillAbbr is my "HCT" and '{?GlobalSkill} will contain all Global skills.

and used another formuala to sum it up.

Sum(SumOfSkills)

which gives me desired output.

Upvotes: 0

4444
4444

Reputation: 3680

Use Running Totals.

Specifically, make a Distinct Count running total for each Date Range code. You can set a formula in the Running Total Wizard to only evaluate records where, for example, {DateRange} = "HCT"

Upvotes: 1

Related Questions