Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Dax help for Timestamp format

Hi,

 

Can any one please help me to format below Total Duration Org as below expected format 

 

 

Expected total duration

694     0 Days 00:01:00

694     7 Days  00:07:08

 

I have tried like this but its not working

 

Column =
IF (
    LEFT ( 'Table1'[Total Duration Org], IFERROR ( SEARCH ( ".",'Table1'[Total Duration Org]), 1 ) - 1 )
        = "",
    0,
    LEFT ('Table1'[Total Duration org], IFERROR ( SEARCH ( ".", 'Table1'[Total Duration Org] ), 1 ) - 1 )
)
    & " DAY "
    & right(left ( 'Table1'[Total Duration org],11 ),8)

 

 

2 Replies

  • jaweher899's avatar
    jaweher899
    Impactful Individual

    please try

     

    Column =
    VAR Days = INT( 'Table1'[Total Duration Org] / 86400 )
    VAR Hours = INT( ( 'Table1'[Total Duration Org] - ( Days * 86400 ) ) / 3600 )
    VAR Minutes = INT( ( 'Table1'[Total Duration Org] - ( Days * 86400 ) - ( Hours * 3600 ) ) / 60 )
    VAR Seconds = MOD( 'Table1'[Total Duration Org], 60 )
    RETURN
    Days & " Days " &
    FORMAT( Hours, "00" ) & ":" &
    FORMAT( Minutes, "00" ) & ":" &
    FORMAT( Seconds, "00" )

  • Anonymous's avatar
    Anonymous
    Not applicable

    jaweher899 Thanks for your reply. I am getting below error.

     

    Actually my duration is in text format.

    Duration.ToText([Complete]-[Started])