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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
v-eqin-msft
Community Support
Community Support

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

v-eqin-msft
Community Support
Community Support

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
Super User
Super User

@anlu20 Maybe:

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

@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.