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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric 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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.