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!

How do I average a time field based on Shifts? 1

Status
Not open for further replies.

KalebsDad78

Technical User
May 6, 2006
57
US
I have a time field that adds two time fields to equal a total elapsed time. Out beside the total time field in a seperate field is a formula that indicates whether that call occurred during "Shift 1" or "Shift 2".

My question is, what would the formula be in the GF that would average the two shifts seperately?

Thanks for your help in advance.

Chad
 
If the calculation between the dates is a simple addition/subtraction, e.g., like {@elapsedtime}:

datediff("s",{table.callstart},{table.callend})

Next insert a formula that you name {@null} where you open and save the formula without adding anything to the formula area. Then you could write a formula like the following for each shift:

if {table.shift} = "Shift 1" then
{@elapsedtime} else
tonumber({@null})

Then you can right click on these formulas and insert averages on them at the group and/or grand total level.

-LB
 
Thanks for your help and the quick reply. I'll try that formula here in just a little bit and see what I get.

Thanks again,

Chad
 
Ok,

That formula worked but the total calculates into a number format rather than in a time format. How can I get it into a time format?

Chad
 
Please see faq767-3543 and set dur equal to the average, like:

numbervar dur := average({@Shift1},{table.groupfield});
//assuming you are averaging at a group level

Change your variable names in the second formula (shift2) or make all the variables local.

-LB



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top