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
e0318476
Helper I
Helper I

Convert Duration (d.hh:mm:ss & hh:mm:ss) to Decimals (in hours)

e0318476_0-1636711493988.png

 

Hi all, 

I have 2 rows that i will need to convert them to decimals in hours.

 

Please help, thank you!

 

1 ACCEPTED SOLUTION
Vera_33
Resident Rockstar
Resident Rockstar

Hi @e0318476 

 

You need total hours, right?

 Duration.TotalHours([yourEndDateTime]-[yourStartDateTime])

View solution in original post

5 REPLIES 5
e0318476
Helper I
Helper I

Hi @Vera_33 & @mahoneypat :

 

e0318476_0-1636943063055.png

 

This is the outcome I want to get (this is done in excel). However, based on the solutions provided by both, it does not re-solve my issue. Please advise!

What is the issue. I suggest you did not properly implement the solution provided by @Vera_33   It works fine here although, in PQ, it displays more precision that you show in your desired result (which you can easily handle by rounding, or by formatting in Excel)

 

Please show the exact code you are using.

Apologies for my mistake. Thank you for pointing out. @ronrsnfld 

mahoneypat
Employee
Employee

Please also see this article for how to best handle DateTime columns and duration calculations in Power BI.

Calculate and Format Durations in DAX – Hoosier BI

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Vera_33
Resident Rockstar
Resident Rockstar

Hi @e0318476 

 

You need total hours, right?

 Duration.TotalHours([yourEndDateTime]-[yourStartDateTime])

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.

Top Solution Authors