Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
paw2
Regular Visitor

Dax help for Timestamp format

Hi,

 

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

 

paw2_1-1676277742209.png

 

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 2
paw2
Regular Visitor

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

 

paw2_0-1676280450037.png

Actually my duration is in text format.

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

jaweher899
Super User
Super User

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" )

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.