cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
EricInNB New Member
New Member

Converting date/time to hours/minutes/seconds in DAX

I have a column of information that I need converted to number of seconds but the one issue I have is the source system providing the data, provides it in a particular format

 

1899-12-31 12:04:42AM should be converted to 4minutes and 42 seconds

1899-12-31 01:12:01AM should be converted to 1 hour, 12 minutes and 01 seconds.

 

Any ideas how I could write formulas to be able to chart this in graphs/tables.

1 REPLY 1
Nathaniel_C Super Contributor
Super Contributor

Re: Converting date/time to hours/minutes/seconds in DAX

Hi @EricInNB ,
In Power Query, add a column using this

(if Text.From(Time.Hour([Column1])) = "0" then "" else 
Text.From(Time.Hour([Column1]))&":")&Text.From(Time.Minute([Column1]))&":"&Text.From(Time.Second([Column1]))

to get thistime.PNG

 

 
Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel

Helpful resources

Announcements
Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 199 members 2,375 guests
Please welcome our newest community members: