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 August 31st. Request your voucher.

Reply
LFrench
Frequent Visitor

Minutes to Hours to Days Calculator

Greetings, 

 

I am doing some work on a previously built PowerBI Dashboard, and have the following cacluated field, but it doesn't seem to be working correctly. It works great for anything that is greater than 60 minutes, but anything less than 60 minutes comes up as (BLANK). I'm guessing it's just a little issue, but I can't seem to figure out what's missing. 

 

Minimum Time for Completion = IF(SUM('Course Information'[MIN])/60>=1&&SUM('Course Information'[MIN])/1440<1,ROUND(SUM('Course Information'[MIN])/60,2)&" Hours",
          IF(SUM('Course Information'[MIN])/1440>=1,ROUND(SUM('Course Information'[MIN])/1440,2)&" Day"))
 
Thanks for any help you can provide!
1 ACCEPTED SOLUTION
AnkitKukreja
Super User
Super User

Hi! @LFrench 

 

Try this, also attaching the pbix.

MinimumTimeForCompletion =
VAR TotalMinutes = SUM('Time'[Mins])
VAR TotalHours = INT(TotalMinutes / 60)
VAR RemainingMinutes = MOD(TotalMinutes, 60)
VAR TotalDays = INT(TotalMinutes / 1440)
VAR RemainingHours = INT(MOD(TotalMinutes, 1440) / 60)
VAR RemainingDayMinutes = MOD(TotalMinutes, 60)

RETURN
IF(
    TotalMinutes >= 1440,
    TotalDays & " Day" & IF(TotalDays > 1, "s ", " ") & RemainingHours & " Hour" & IF(RemainingHours > 1, "s ", " ") & RemainingDayMinutes & " Minute" & IF(RemainingDayMinutes > 1, "s", ""),
    IF(
        TotalMinutes >= 60,
        TotalHours & " Hour" & IF(TotalHours > 1, "s ", " ") & RemainingMinutes & " Minute" & IF(RemainingMinutes > 1, "s", ""),
        TotalMinutes & " Minute" & IF(TotalMinutes > 1, "s", "")
    )
)
 
Sample solution - 
AnkitKukreja_0-1742802523459.png

 

 
 
For Power BI trainings or support dm or reach out to me on LinkedIn.
If my response has successfully addressed your question or concern, I kindly request that you mark this post as resolved. Additionally, if you found my assistance helpful, a thumbs-up would be greatly appreciated.

Thanks,
Ankit Kukreja
www.linkedin.com/in/ankit-kukreja1904

View solution in original post

4 REPLIES 4
AnkitKukreja
Super User
Super User

Hi! @LFrench 

 

Try this, also attaching the pbix.

MinimumTimeForCompletion =
VAR TotalMinutes = SUM('Time'[Mins])
VAR TotalHours = INT(TotalMinutes / 60)
VAR RemainingMinutes = MOD(TotalMinutes, 60)
VAR TotalDays = INT(TotalMinutes / 1440)
VAR RemainingHours = INT(MOD(TotalMinutes, 1440) / 60)
VAR RemainingDayMinutes = MOD(TotalMinutes, 60)

RETURN
IF(
    TotalMinutes >= 1440,
    TotalDays & " Day" & IF(TotalDays > 1, "s ", " ") & RemainingHours & " Hour" & IF(RemainingHours > 1, "s ", " ") & RemainingDayMinutes & " Minute" & IF(RemainingDayMinutes > 1, "s", ""),
    IF(
        TotalMinutes >= 60,
        TotalHours & " Hour" & IF(TotalHours > 1, "s ", " ") & RemainingMinutes & " Minute" & IF(RemainingMinutes > 1, "s", ""),
        TotalMinutes & " Minute" & IF(TotalMinutes > 1, "s", "")
    )
)
 
Sample solution - 
AnkitKukreja_0-1742802523459.png

 

 
 
For Power BI trainings or support dm or reach out to me on LinkedIn.
If my response has successfully addressed your question or concern, I kindly request that you mark this post as resolved. Additionally, if you found my assistance helpful, a thumbs-up would be greatly appreciated.

Thanks,
Ankit Kukreja
www.linkedin.com/in/ankit-kukreja1904
Deku
Super User
Super User

Var mins = SUM('Course Information'[MIN])

Return

Switch(

True,

Mins < 60, mins & " minutes",

Mins < 1440, round(divide(mins, 60),2) & " hours",

Mins >= 1440, round(divide(mins, 1440),2), & " days"

)


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!
LFrench
Frequent Visitor

I attempted this, but got the following error: 

Error Message.jpg

Need to add this at the start to name the measure

 

Minimum Time for Completion =


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

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.