Focal Point
[SOLVED]Average and Max of a Compute?

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/8467097086

February 15, 2016, 02:08 PM
hfung1
[SOLVED]Average and Max of a Compute?
Hi,

Right now, I created a define to change a couple of time fields to the right format, then I've created a computed field that shows the difference between these two times (start and end time). I was wondering if it is possible to show the average time difference as well as the maximum time difference, by each of my BY fields? Thank you.

My code is as follows:


DEFINE FILE FACT_OR
Start_time/HHIA =HINPUT(12,'00000000' | FACT_OR.FACT_OR.START_TIME,8,'HHI') ;
End_time/HHIA =HINPUT(12,'00000000' | FACT_OR.FACT_OR.CLOSE_TIME,8,'HHI') ;
END

TABLE FILE FACT_OR
SUM
COMPUTE Length/D12.2 = HDIFF(FACT_OR.FACT_OR.End_time, FACT_OR.FACT_OR.Start_time, 'MINUTE', 'D9');
FACT_OR.FACT_OR.Start_time
FACT_OR.FACT_OR.End_time
CNT.FACT_OR.FACT_OR.CASE_NUMBER AS 'Volume'
BY LOWEST FACT_OR.FACT_OR.SERVICE

This message has been edited. Last edited by: hfung1,


8.0.0.2
Windows, All Outputs
February 16, 2016, 06:42 AM
GamP
You can put the computed field in your define also, and then use the sum ave.defined field to show the average per your by-fields.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
February 16, 2016, 07:03 AM
Danny-SRL
Hi,

If you put your calculation in a COMPUTE, be aware that WF will SUM the Start_time and the End_time and after will calculate the difference. I doubt this is the answer you will want.

So, as GamP rightly suggests, put the calculation in the DEFINE.


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

February 16, 2016, 09:19 AM
hfung1
Thank you it works!


8.0.0.2
Windows, All Outputs