Forum Discussion
Aggregating Duration/Time
- 10 years ago
Sure, I can give a general solution but I have no clue as to what AHT refers to. Average Hours Talked? In any case, simple enough, I've done in a series of steps to make it readable.
Given a number of seconds "[Seconds]", create the following columns/measures or what not:
Hours = ROUNDDOWN([Seconds]/360,0)
Minutes = ROUNDDOWN(([Seconds]-[Hours]*360)/60,0)
Sec = MOD(([Seconds]-[Hours]*360),60)
H = IF(LEN([Hours])=1,CONCATENATE("0",[Hours]),CONCATENATE("",[Hours]))
M = IF(LEN([Minutes])=1,CONCATENATE("0",[Minutes]),CONCATENATE("",[Minutes]))
S = IF(LEN([Sec])=1,CONCATENATE("0",[Sec]),CONCATENATE("",[Sec]))
Text = CONCATENATE([H],CONCATENATE(":",CONCATENATE([M],CONCATENATE(":",[S]))))
Text comes out like 01:03:36 for a value of 576 seconds.
I have the same problem, I can not hit these hours ...
I almost solved the problem, I need to correct the seconds.
_Duration Tickets =
VAR Duration = [_Total Hours]
VAR Hours = INT (Duration)
VAR Minutes = INT ((Duration - Hours) * 60)
VAR Seconds = ROUNDUP(MOD ( MOD( Duration - ( Hours * 3600 );3600 ); 60 );0)
VAR H =
IF ( LEN ( Hours ) = 1;
CONCATENATE ( "0";Hours );
CONCATENATE ( ""; Hours )
)
VAR M =
IF (
LEN ( Minutes ) = 1;
CONCATENATE ( "0"; Minutes );
CONCATENATE ( ""; Minutes )
)
VAR S =
IF (
LEN ( Seconds ) = 1;
CONCATENATE ( "0"; Seconds );
CONCATENATE ( ""; Seconds )
)
RETURN
CONCATENATE (
H;
CONCATENATE ( ":"; CONCATENATE ( M; CONCATENATE ( ":"; S ) ) )
)