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.
Hi there
I'm trying to convert a duration total to Days, Hours and Minutes.
So for instance someone works 7 hours a day and over the course of a month has worked 560 hours. Im trying to covert 560 hours to X days, x hours, x minutes.
I just cant seem to do this and i'd be very grateful if someone could help me with this.
Many thanks
Karen
Solved! Go to Solution.
I see I made a mistake while converting the hours, also I didn't consider that your working day is 7 hours... please try this, it should work:
OverTime =
VAR OverTimeHours = [OverTimeHoursMeasure]
VAR Days = INT ( WorkingHours / 7 )
VAR Hours = INT ( WorkingHours - Days * 7 )
VAR Minutes = ROUND ( MOD ( WorkingHours, 1 )* 60 , 0)
RETURN
Days & " Days " & Hours & " Hours " & Minutes & " Minutes"
Hi there
Thank you for getting back to me. Unfortunately, it doesnt quite work. Here's my result using your formula . Format 2 is your formula and Duration (h) is the number of hours they've done. So for instance Garden, Duration (h) = 32.50. So really they've worked 4 days 4 hours. Can you help with this please.
Thank you
Karen
I see I made a mistake while converting the hours, also I didn't consider that your working day is 7 hours... please try this, it should work:
OverTime =
VAR OverTimeHours = [OverTimeHoursMeasure]
VAR Days = INT ( WorkingHours / 7 )
VAR Hours = INT ( WorkingHours - Days * 7 )
VAR Minutes = ROUND ( MOD ( WorkingHours, 1 )* 60 , 0)
RETURN
Days & " Days " & Hours & " Hours " & Minutes & " Minutes"
Thats brilliant thank you. Works a treat.
Kind regards
Karen
Try this (replace [OverTimeHoursMeasure] with the correct measure name):
OverTime =
VAR OverTimeHours = [OverTimeHoursMeasure]
VAR Days = INT ( WorkingHours / 24 )
VAR Hours = INT ( WorkingHours - INT ( WorkingHours / 24 ) )
VAR Minutes = ROUND ( MOD ( WorkingHours, 1 )* 60 , 0)
RETURN
Days & " Days " & Hours & " Hours " & Minutes & " Minutes"
Thanks, I had a similar question and I figured it out using your proposed solution.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
49 | |
26 | |
20 | |
15 | |
12 |
User | Count |
---|---|
57 | |
49 | |
43 | |
19 | |
18 |