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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Chart Average vs Calculated Average

Status
Not open for further replies.

BradCustom

IS-IT--Management
Oct 5, 2007
296
US
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.
Thanks for your help.
 
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
 
Hi,
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,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein
 
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.

Thanks for your help and let me know if you need any more information.


 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top