Forum Discussion
Anonymous
6 years agoNot applicable
Convert Decimal Duration in HH:MM:SS format
Greentings, Power BI friends! A got little problem and I'm asking for help because I couldn't find a solution among the forum posts. First, I have this table with some dates, hours, minutes a...
- Anonymous6 years ago
You could try something like this:
Calculated column:
Seconds = DATEDIFF(CreationDate, ResolutionDate, SECOND)
Calculated column:Your_Time =IF([Seconds] <> BLANK();VAR Duration = [Seconds]VAR hh =INT ( Duration / 3600)VAR Minutes =INT ( MOD( Duration - ( hh * 3600 );3600 ) / 60)VAR Seconds =ROUNDUP(MOD ( MOD( Duration - ( hh * 3600 );3600 ); 60 );0) // We round up here to get a whole numberVAR H =IF ( LEN ( hh ) = 1;CONCATENATE ( "0"; hh );CONCATENATE ( ""; hh ))VAR M =IF (LEN ( Minutes ) = 1;CONCATENATE ( "0"; Minutes );CONCATENATE ( ""; Minutes ))VAR S =IF (LEN ( Seconds ) = 1;CONCATENATE ( "0"; Seconds );CONCATENATE ( ""; Seconds ))RETURNCONCATENATE (H;CONCATENATE ( ":"; CONCATENATE ( M; CONCATENATE ( ":"; S ) ) )); BLANK())
amitchandak
Super User
6 years ago