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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
anlu20
Frequent Visitor

Convert from decimal to duration (HH:MM:SS)

How can I convert decimal to duration format?

 

response timetarget response time
00:30:002,50
01:00:000,433
02:00:001,133

 

I want to convert the column "target response time" to the format of the column "response time".

Example:  2,50 must be converted to 02:30:00

 

Thank you.

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

duration = [target response time] / 24

cast the calculated column to type "Time"

Screenshot 2021-07-29 205603.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @anlu20 ,

 

Can you let me know whether this answer worked for you or not please?

If it worked ok, please mark as the solution to help people with similar problems find the answer quicker.

 

Best Regards,
Eyelyn Qin

Anonymous
Not applicable

Hi @anlu20 ,

 

You could try the following formula to create column:

Time Column =
VAR _totalseconds = [target response time] * 3600
VAR _hour =
    INT ( [target response time] )
VAR _min =
    INT ( ( _totalseconds - _hour * 3600 ) / 60 )
VAR _sec = _totalseconds - _hour * 3600 - _min * 60
RETURN
    TIME ( _hour, _min, _sec )

After change the data type and format type, the final output is shown below:

Time column.PNG

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

CNENFRNL
Community Champion
Community Champion

duration = [target response time] / 24

cast the calculated column to type "Time"

Screenshot 2021-07-29 205603.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Anonymous
Not applicable

This worked for me. Now, I need to figure how to get them to return a sum in a Matrix. Currently, I cannot select sum of the duration in a Matrix. It only allows me to select first or count. 

Greg_Deckler
Community Champion
Community Champion

@anlu20 Maybe:

Column = FORMAT(INT([Column1]),"00") & ":" & FORMAT(([Column1] - INT([Column1])) * 60,"00") & ":00"


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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