Forum Discussion
Rounding up time
Hey guys, I've got the following situation below and basically in the column where the time is, I need to round it up to only hours, if its above 40 minutes. So lets say its 15:30 then it displays 15, but if its 15:40 then it rounds up to 16 hours. Any way to achieve that by adjusting the code?
Any help appreciated.
Anonymous
You need to use the seconds as input for my formula, it converts it into time.
I have attached your file with the column added.You can download the file: HERE
________________________
If my answer was helpful, please consider Accept it as the solution to help the other members find it
Click on the Thumbs-Up icon if you like this reply 🙂
15 Replies
- mahoneypatMicrosoft Employee
Please try a column expression like this to get your desired result.
Rounded Time = var hours = HOUR('Table'[Time])var minutes = MINUTE('Table'[Time])return IF(minutes>=40, hours +1, hours)Regards,Pat - FowmySuper User
Anonymous
Time rounded as expected:Rounded Time = IF( MINUTE([TIME]) >= 40, MROUND([Time], 1/24 ), HOUR([Time])/24 )________________________
If my answer was helpful, please consider Accept it as the solution to help the other members find it
Click on the Thumbs-Up icon if you like this reply 🙂
- AnonymousNot applicable
Fowmy mahoneypat This is what i get: Might be the reason that Im using charlie eidens duration and displaying time as a whole number.
- FowmySuper User
Anonymous
My formula is based on Time data type column, if you have any other type, I need to do it differently.
You may share a sample PBIX file to check.________________________
If my answer was helpful, please consider Accept it as the solution to help the other members find it
Click on the Thumbs-Up icon if you like this reply 🙂