Forum Discussion
days to duration calculation
Hi please I am converting an excel report that has calculation changing days to duration and subtracting them like below
The conversion calculation is column[days]/24 then the format is [hhh]:mm and the yellow highlight is the difference between the two conversion .
I tried using time function and choosing hh:mm:ss but the out was different , please any advice on the best approach. Thanks
5 Replies
- d_gosbellSuper User
Anonymous wrote:
I tried using time function and choosing hh:mm:ss but the out was different , please any advice on the best approach. Thanks
Unfortunately this will not work in Power BI as the hh:mm:ss format just ignores the date portion of the data. So it works for any durations upto 23:59:59, but as soon as you have amounts larger than 24 hours it is an issue. So a duration like 25:15:00 will simply show as 1:15:00.
If your raw data is in days, why not just subtract the 2 integer day figures?
It's either that or you will probably need to use decimal hours (so 1hr 30min becomes 1.5 hrs)
- AnonymousNot applicable
Thanks for the update
- v-juanli-msftCommunity Support
Hi Anonymous
I have some doubts and could you solve them for me?
Does ‘1325:00’ mean 1325 days? And do you want to convert ‘045:00’ to ‘hh:mm:ss’?
If so, I would recommend referring to this article.
The following expression is modified to meet the requirements.
Measure = INT ( MAX ( [column] ) * 24 ) & " : " & RIGHT ( "0" & INT ( MAX ( [column] ) * 24 - INT ( MAX ( [column] ) * 24 ) ), 2 ) & ":" & RIGHT ( "0" & INT ( MAX ( [column] ) * 24 - INT ( MAX ( [column] ) * 24 ) - INT ( MAX ( [column] ) * 24 - INT ( MAX ( [column] ) * 24 ) ) ), 2 )If not, can you give me some detailed information? Then I can better help you solve the problem.
Best Regards
MaggieCommunity Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.- AnonymousNot applicable
Thanks for the response, will implement and get back to you
- v-juanli-msftCommunity Support
Hi Anonymous
Is this problem sloved?
If it is sloved, could you kindly accept it as a solution to close this case?
If not, please let me know.
Best Regards
Maggie