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
Anonymous
Not applicable

Change decimal to duration

I have a column in a table called duration which is in decimal format, for example, 34.60 but I need to change that to mm:ss format so instead it should be 34minutes 36 seconds , or 34:36. 

 

How would I be able to do this? 

1 ACCEPTED SOLUTION

Also, If you want to do it in Power Query, change the type of your column to Text(or create the new one as text) and then create the new column as a below :

Text.BeforeDelimiter( [Duration],".") & ":" & Number.ToText( Number.FromText( Text.AfterDelimiter( [Duration],".")) *6)

Mahyartf

View solution in original post

7 REPLIES 7
MahyarTF
Memorable Member
Memorable Member

Hi,

Create the column as below : 

Time = time(0,
            hour(FORMAT(TIME(TRUNC(Sheet229[Duration],0),(Sheet229[Duration]-TRUNC(Sheet229[Duration],0))*60,0),"long time")),
            minute(FORMAT(TIME(TRUNC(Sheet229[Duration],0),(Sheet229[Duration]-TRUNC(Sheet229[Duration],0))*60,0),"short time"))
        )
******** Sheet229[Duration] is my decimal column
Appreciate your Kudos
Please mark it as solution if it helps 
Mahyartf

Also, If you want to do it in Power Query, change the type of your column to Text(or create the new one as text) and then create the new column as a below :

Text.BeforeDelimiter( [Duration],".") & ":" & Number.ToText( Number.FromText( Text.AfterDelimiter( [Duration],".")) *6)

Mahyartf
Dinesh_Suranga
Continued Contributor
Continued Contributor

@Anonymous ,

Hi

Do you want this in DAX or Power query?

Thank you.

Anonymous
Not applicable

Power Query is fine, but what is the DAX Solution?

@Anonymous ,

Hi,

You can try following code to create new column in power query.

= Text.BeforeDelimiter( [Duration],".") & ":" & Number.ToText( Number.FromText( Text.AfterDelimiter( [Duration],".")) *0.6)

 Thank you.

Anonymous
Not applicable

Error

@Anonymous 

Hi

May I know the error?

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.