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
ChristoAClark
Frequent Visitor

Time conversion

We use an older phone software that pulls phone data in seconds. So in Excel we have to divide the number by 86,400 and then convert it to the TIME format HH:MM:SS. I have tried to do this in Power BI Power Query and I get nothing but errors using TIME and I even tried DURATION. I have even tried to leave the number in orignal seconds form and creating a measure in Power BI that would do the conversion, but I do not get a choice of TIME, only numbers, decimals, etc. How can I solve this issue? Thank you 

ChristoAClark_0-1667585139163.png

 

2 ACCEPTED SOLUTIONS
Greg_Deckler
Super User
Super User

@ChristoAClark Chelsie Eiden's Duration - Microsoft Power BI Community


@ 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...

View solution in original post

ppm1
Solution Sage
Solution Sage

Please see this article/video for a great way to handle durations. Keep them as decimal, do your calculations, and then format it however you want at the very end.

Calculate and Format Durations in DAX – Hoosier BI

Pat

Microsoft Employee

View solution in original post

6 REPLIES 6
ppm1
Solution Sage
Solution Sage

Please see this article/video for a great way to handle durations. Keep them as decimal, do your calculations, and then format it however you want at the very end.

Calculate and Format Durations in DAX – Hoosier BI

Pat

Microsoft Employee
serpiva64
Super User
Super User

Hi,

you can create  a calculated column this way

Column = var currsec ='Table'[Seconds]
VAR hours =ROUNDDOWN(DIVIDE('Table'[Seconds],3600),0)
var minutes =ROUNDDOWN(divide('Table'[Seconds]-hours*3600,60),0)
var seconds = 'Table'[Seconds]-hours*3600-minutes*60
RETURN
time(hours,minutes, seconds)
and you get  your result
serpiva64_0-1667587562561.png

as you see there is a problem if time is over a day. if that is your problem need some more steps.

 

If this post is useful to help you to solve your issue consider giving the post a thumbs up 

 and accepting it as a solution !

 

Sorry, but we do reports that calculate the entire month so the numbers often go over 100 hours so yes, that is over a day

Greg_Deckler
Super User
Super User

@ChristoAClark Chelsie Eiden's Duration - Microsoft Power BI Community


@ 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...

@Greg_Deckler  So this solution did work for me, however, I couldn't get the custom property piece set. I did find another article that showed you can literally type in Excel Format Cell custom in the "Format" box of the measure. 

Anyway, thank you sooooo much. This is going to save me a ridiculous amount of time each month!

In her code, it's looking for [Duration] and not finding it. Do I need to create a Duration column? Or would this refer to one of my data columns. 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors