×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Chart Average vs Calculated Average

## Chart Average vs Calculated Average

(OP)
Hi,
I'm using Crystal Reports 2011
I calculate an average Machine Utilization based on the number of available hours vs. number of hours worked for a given time period and group it by Machine (workcenter). The calculation checks out but when I try to chart the daily utilization and average (by group) it over the date range selected the chart shows a different number than the calculated average. Anyone ever come across this problem?
If needed I can post the formulas I'm using.

### RE: Chart Average vs Calculated Average

I think you would have to show your formulas to tease this out. I wonder if the chart group is averaging all values versus averaging the values per day. You should also explain your chart setup.

-LB

### RE: Chart Average vs Calculated Average

Hi,

#### Quote:

but when I try to chart the daily utilization and average (by group)

What do you mean by “the daily utilization” vs. “average (by group)?”

One one hand you have HOURS (0-24) while on the other you have a percentage (0-1)?

Skip,

Just traded in my OLD subtlety...
for a NUance!

"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein

### RE: Chart Average vs Calculated Average

(OP)
LB
I figured you'd need to see the formulas. I'll start with how I calculate the Utilization for each day.

#### CODE

@Utilization
if (Sum ({@WCHoursWorkedLine},({Transaction_Data.Transaction_Start}))=0)
then 0
else
(Sum ({@WCHoursWorkedLine},({Transaction_Data.Transaction_Start}))/({@WCCapicity}))*100 

This is total hours worked for the day

#### CODE

@WCHoursWorkedLine
DateDiff ('h',{Transaction_Data.Transaction_Start} ,{Transaction_Data.Transaction_End} ) 

This is Workcenter capacity for the day

#### CODE

@WCCapicity
if (DatePart ("h",{Transaction_Data.Transaction_Start}))>= 15 and {@WCHoursWorkedLine}>2.5
then 16
else
if (DatePart ("h",{Transaction_Data.Transaction_Start}))>= 14 and {@WCHoursWorkedLine}>3.5
then 16
else
if ({@WCHoursWorkedLine})>10 and
({Transaction_Data.Employee}) in ["396","044","378","049"]
then 8
else 8 

The chart is structured as follows:
On Change of:
Workcenter (Group1)

Show Value:
Avg of @Utilization

The calculated average is done with the formulas below:

This is Hours Worked
Sum of {@WCHoursWorkedLine}

This is Workcenter Capacity:

#### CODE

whileprintingrecords;

Global numbervar newtotalvar; 

This is Workcenter Capacity for the day:

#### CODE

shared numbervar WCC :=
if (Sum ({@WCHoursWorkedLine}, {Transaction_Data.Transaction_Start}))>10 and
({Transaction_Data.Employee}) in ["396","044","378","049"]
then 16
else 8 

This is the Calculated average for the day:

#### CODE

if (Sum ({@WCHoursWorkedLine}, {Work_Center.Work_Center}))=0
then 0
else
(Sum ({@WCHoursWorkedLine}, {Work_Center.Work_Center})/{@GrandTotWCCap})*100 

Thought I should mention that Group2 is Transaction Start Date
The Chart is in the report footer.

### RE: Chart Average vs Calculated Average

All of your nested formulas are just too confusing for me. I think the issue might be that your utilization formula is per day, while your calculated average is per work center (across days), so not sure why you are calling that the calculated average for the day. You might try adding in the group per day as a second on change of field either as the higher order one or the lower order one, and see if the results make more sense to you.

-LB

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!