Forum Discussion
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?
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)
7 Replies
- Dinesh_Suranga
Continued Contributor
Anonymous ,
Hi
Do you want this in DAX or Power query?
Thank you.
- AnonymousNot applicable
Power Query is fine, but what is the DAX Solution?
- Dinesh_Suranga
Continued Contributor
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.
- MahyarTF
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 columnAppreciate your KudosPlease mark it as solution if it helps- MahyarTF
Memorable Member
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)