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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

How to change decimal to time format (HH:MM:SS)

Hello guys, I encountered some problems while working with time-based data. 

I would like to round down (floor) the "time" column to 15mins and the returned results are in decimal format. I wonder how to change them to time format just like the "time column" 

 

Thanks for your help and time!

 
1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi @Anonymous ,

 

Use  below dax expression to create a calculated column:

 

floor = 
var a =FLOOR(MINUTE('Table'[Time]),15)
Return
TIME(HOUR('Table'[Time]),a,SECOND('Table'[Time]))

 

And you will see:

Annotation 2020-04-20 110442.png

You can also create  a measure to achieve it.

 

Measure = 
var a=FLOOR(MINUTE(SELECTEDVALUE('Table'[Time])),15)
Return
TIME(HOUR(SELECTEDVALUE('Table'[Time])),a,SECOND(SELECTEDVALUE('Table'[Time])))

 

 

And you will see:

Annotation 2020-04-20 111327.png

For the related .pbxi file,pls click here.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

 

View solution in original post

4 REPLIES 4
v-kelly-msft
Community Support
Community Support

Hi @Anonymous ,

 

Use  below dax expression to create a calculated column:

 

floor = 
var a =FLOOR(MINUTE('Table'[Time]),15)
Return
TIME(HOUR('Table'[Time]),a,SECOND('Table'[Time]))

 

And you will see:

Annotation 2020-04-20 110442.png

You can also create  a measure to achieve it.

 

Measure = 
var a=FLOOR(MINUTE(SELECTEDVALUE('Table'[Time])),15)
Return
TIME(HOUR(SELECTEDVALUE('Table'[Time])),a,SECOND(SELECTEDVALUE('Table'[Time])))

 

 

And you will see:

Annotation 2020-04-20 111327.png

For the related .pbxi file,pls click here.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

 

TomMartens
Super User
Super User

Hey @Anonymous ,

 

I use this approach to put time values into a bucket, the below DAX statement Is used to create a calculated column:

 

floored time = 
var h = HOUR('Table'[Time])
var m = FLOOR(MINUTE('Table'[Time]) , 15)
var s = 0
var flooredtime = TIME(h , m , s)
return flooredtime

 

This is the result:

image.png

Hopefully, this provides what you are looking for.

 

Regards,

Tom

 

Stay safe, stay healthy



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
Anonymous
Not applicable

Please find the captured screen below.

Capture.PNG

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.