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

Concert duration to format DD HH MM SS

Hello I'm new to Power BI and I would like to know if there is a way to convert in the Power Query editor the time format DD/MM/YYYY HH:MM:SS to a more readable format like DD HH:MM:SS?  
Thank you in advance

2 ACCEPTED SOLUTIONS
ibarrau
Super User
Super User

Hi. Have you tried in the edit queries to change data type to "Time"?

You can read more about it here:

https://docs.microsoft.com/en-us/power-bi/desktop-data-types#determine-and-specify-a-columns-data-ty...

 

Regards,


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

View solution in original post

dax
Community Support
Community Support

Hi @Anonymous , 

You could try below M code to see whether it work or not(because there is no time format like  DD hh:mm:ss ,this will convert it to text instead of time)

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtA31DdUMDSyMjKwMjRVitWBihrrmyoYGloZGAARQtRSH6gkFgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [date = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"date", type datetime}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each DateTime.ToText([date], "dd HH:mm:ss"))
in
    #"Added Custom"

 

 

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
dax
Community Support
Community Support

Hi @Anonymous , 

You could try below M code to see whether it work or not(because there is no time format like  DD hh:mm:ss ,this will convert it to text instead of time)

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtA31DdUMDSyMjKwMjRVitWBihrrmyoYGloZGAARQtRSH6gkFgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [date = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"date", type datetime}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each DateTime.ToText([date], "dd HH:mm:ss"))
in
    #"Added Custom"

 

 

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

ibarrau
Super User
Super User

Hi. Have you tried in the edit queries to change data type to "Time"?

You can read more about it here:

https://docs.microsoft.com/en-us/power-bi/desktop-data-types#determine-and-specify-a-columns-data-ty...

 

Regards,


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

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.

Top Solution Authors
Top Kudoed Authors