Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Summarizing Grouped Data 1

Status
Not open for further replies.

SharenJ

Technical User
Nov 18, 2010
9
CA
I have a crystal 2008 report which pulls employee time hours. The report is grouped by employee then date. The daily hours are summaried. With a formula if {@Hour Type}= "SH" then {PAYIHIST.WORKEDHRS}/Sum ({PAYIHIST.WORKEDHRS}, {PAYIHIST.SHIFTDATE}, "daily") else 0 the sick hours are calculated into days and any other hours are 0. I now need to total the sick days by employee. I have tried the “Insert Summary” & Running Totals but @Days is not available. I believe a formula is needed but have not been able to figure it out. Any assistance is greatly appreciated.
 
What you are showing is a ratio, not number of hours. If you create a formula like this:

if {@Hour Type}= "SH" then
{PAYIHIST.WORKEDHRS}

...you can place this in the detail section and then right click on it and insert a sum on it at the employee level.

-LB
 
Thank you IBass. I am not following or have not clearly expressed my problem, sorry either way. It is the days I need a total for and some are partial days e.g.
Group Level 1 Employee Number
Group Level 2 Shift Date
Details are {PAYIHIST.SHIFTDATE}/({PAYIHIST.WORKEDHRS}/{@Hour Type}
Jane on March 1 has 3.75 hrs WH & 3.75 hrs SH
Jane on March 2 has 11.25 hrs SH
Group Level 2 has a summary on ({PAYIHIST.WORKEDHRS} despite the type to get the total shift hours for the day
Each Detail line has a formula to calculate the Sick Days if {@Hour Type}= "SH" then {PAYIHIST.WORKEDHRS}/Sum ({PAYIHIST.WORKEDHRS}, {PAYIHIST.SHIFTDATE}, "daily") else 0
Jane on March 1 has .5 Sick Day
Jane on March 2 has 1 Sick Day
I need to total the Sick Days at Group Level 1 (by employee)
Thank you for your time on this your assistance is greatly appreciated.
 
That is an unusual way to determine sick days, as the number of hours per day appear to vary. Anyway, to do the calculation you would like, you need to use a variable, because of the summary involved, and this will require three formulas. The sick days will need to be shown in the group footer for employee.

First create a formula {@sickhrs}:

if {@Hour Type}= "SH" then
{PAYIHIST.WORKEDHRS}

Then create these formulas and place them where indicated:

//{@reset} to be placed in the employee group header and suppressed:
whileprintingrecords;
numbervar sd;
if not inrepeatedgroupheader then
sd := 0;

//{@accum} to be placed in the shiftdate group header or footer and suppressed:
whileprintingrecords;
numbervar sd;
sd := sd + sum({@sickhrs},{PAYIHIST.SHIFTDATE}, "daily")/Sum ({PAYIHIST.WORKEDHRS}, {PAYIHIST.SHIFTDATE}, "daily")

//{@displayresult} to be placed in the employee group footer:
whileprintingrecords;
numbervar sd;

-LB
 
You are correct we have shift lengths that vary from 4 to 14 hours a constant at our workplace is rare. Thank you so much this worked perfectly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top