Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
lamysroe
Advocate I
Advocate I

Time format hh:mm adding an hour

I have columns that were orignally in milleseconds and were calculated into decimal hours. From there I used the following to get the duration into hh:mm format. It worked for half of the columns, but for the other half I am over by an hour. Based on the examples below, I think this is happening because the minutes are past the half hour, but the minutes are correct on all entries. 

 

19.64 is coming out to 20:38 - off by an hour

2.71   is coming out to 3:42   - off by an hour

8.04   is coming out to 8:02   - Correct

3.37   is coming out to 3:22   - Correct 

 

 

1st response bhrs hh:mm = 
var hourNo=INT([Avg First Response Time Bhrs Calculated]/60)
var minuteNO=MOD([Avg First Response Time Bhrs Calculated],60)
var secondNo=INT(([Avg First Response Time Bhrs Calculated]-INT([Avg First Response Time Bhrs Calculated]))*60)
return
FORMAT(hourNo,"#00")&":"&FORMAT(minuteNO,"#00")&":"&FORMAT(secondNo,"#00")
1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @lamysroe ,

You can change your Column like this:

1st response bhrs hh:mm 2 =
VAR hourNo =
    INT ( [Avg First Response Time Bhrs Calculated] / 60 )
VAR minuteNO =
    INT ( MOD ( [Avg First Response Time Bhrs Calculated], 60 ) )
VAR secondNo =
    INT (
        (
            [Avg First Response Time Bhrs Calculated]
                - INT ( [Avg First Response Time Bhrs Calculated] )
        ) * 60
    )
RETURN
    FORMAT ( hourNo, "#00" ) & ":"
        & FORMAT ( minuteNO, "#00" ) & ":"
        & FORMAT ( secondNo, "#00" )

Time format hh_mm adding an hour.PNG

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Icey
Community Support
Community Support

Hi @lamysroe ,

You can change your Column like this:

1st response bhrs hh:mm 2 =
VAR hourNo =
    INT ( [Avg First Response Time Bhrs Calculated] / 60 )
VAR minuteNO =
    INT ( MOD ( [Avg First Response Time Bhrs Calculated], 60 ) )
VAR secondNo =
    INT (
        (
            [Avg First Response Time Bhrs Calculated]
                - INT ( [Avg First Response Time Bhrs Calculated] )
        ) * 60
    )
RETURN
    FORMAT ( hourNo, "#00" ) & ":"
        & FORMAT ( minuteNO, "#00" ) & ":"
        & FORMAT ( secondNo, "#00" )

Time format hh_mm adding an hour.PNG

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.