HHMMSS.StartTimeEndTime
Convert duration between start and end times to HH:MM:SS format string.
Syntax
DaxLib.FormatString.HHMMSS.StartTimeEndTime ( startTime, endTime )
Definition
DAX
// Convert duration between start and end times to HH:MM:SS format string
(
// Start datetime
// Include measure, expression, or scalar value
startTime: EXPR,
// End datetime
// Include measure, expression, or scalar value
endTime: EXPR
) =>
VAR _DurationInSeconds =
INT( ( endTime - startTime ) * 86400 )
VAR _Hours =
INT( _DurationInSeconds / 3600 )
VAR _Minutes =
INT( MOD( _DurationInSeconds, 3600 ) / 60 )
VAR _Seconds =
INT( MOD( _DurationInSeconds, 60 ) )
VAR _Result =
DaxLib.FormatString.Component.MakeStringSafe(
FORMAT ( _Hours, "00" ) & ":" &
FORMAT ( _Minutes, "00" ) & ":" &
FORMAT ( _Seconds, "00" )
)
RETURN
_Result
Parameters
| Parameter | Type | Description |
|---|---|---|
startTime |
DATETIME | Start datetime value |
endTime |
DATETIME | End datetime value |
Example
DaxLib.FormatString.HHMMSS.StartTimeEndTime ( MIN( 'Tasks'[StartTime] ), MAX(
'Tasks'[EndTime] ) )
Use this function to format duration between start and end datetime values.
Related Functions
- HHMMSS.Seconds - Duration from seconds value
- Component.MakeStringSafe - String safety for format strings