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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
Thankyouverymuc
New Member

Get Time from DateTime field

Dear Power BI community, 

 

Can anyone please help me with a DAX formula with extracting the time value from a datetime field.

See for example the below datetime values and I want to extract the timevalue from the datetime field

Thankyouverymuc_0-1654885255631.png

So for the output, I would like to see 11:17:56 or 3:00:00 in a new column - I want to keep the current column which shows datetime and add a new column with the correct formula. 

Can anyone please help me? 

Thank you guys! 

2 ACCEPTED SOLUTIONS

Hi @Thankyouverymuc ,

 

Here a solution for a calculated column as described in this blog post as well:
https://www.tackytech.blog/how-to-crack-the-mystery-of-the-mighty-dax/#22_How_to_retrieve_the_time_f...

 

We start by duplicating the datetime column:

--> Right click on a column in your table and select new column:

tomfox_2-1654887005821.png

 

--> duplicate the column by referencing the datetime column:

tomfox_3-1654887104156.png

NewColumn = TableDateTime[DateTime]
 

Then, just change the format to Time (just like @Syk  suggested in Power Query):

tomfox_4-1654887222596.png

 

 

The result:

tomfox_5-1654887238150.png

 

 

 

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

View solution in original post

TheoC
Super User
Super User

Sorry to jump in on this forum but noticed there wasn't a DAX solution on here.  If you're looking for a DAX solution, you can extract the Time from a DateTime column by doing the following:

1.  Click on new Calculated Column

2.  Time = FORMAT ( 'TableName'[DateTimeColumnName] , "hh:mm:ss" )

3. Convert the new Time column from Text to Time.

 

Hope this helps.

 

Theo

 

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

View solution in original post

23 REPLIES 23
Thankyouverymuc
New Member

Hi Guys! Thank you both for your quick responses but I can't work through the Power Query because I don't have the rights yet so could you please give me a solution with a DAX formula? In Excel, there are various ways through which I can convert it but somehow I can't find it with DAX.

tackytechtom
Super User
Super User

Hi @Thankyouverymuc ,

 

One way to achieve this is by using Power Query:

 

tomfox_0-1654885876864.png

 

 

Just add a new column with the following code:

tomfox_1-1654885954376.png

 

= Time.From([DateTime])

 

Let me know, if this helps 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/

 



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Syk
Super User
Super User

Right click on column and hit duplicate
Then click on the new column and go to transform > Time > Time only

Syk_0-1654885926805.png

 

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Solution Authors