Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Calculate time different in hours

Hi Guys,

 

I am trying to calculate accurate Hours from two different shift. When I applied datediff fiction on the column it shows 7.5 hours instead of 7.6 hours. Please refer attached. 

Any solution? I am new to powerbi

  • Anonymous 

    pls try this

    Column = ('Table'[end]-'Table'[start])*24-'Table'[break time]

  • Hi,  Anonymous 

    The result obtained by the DATEDIFF function is an integer, and it does not contain the decimal part. You can consider counting the result in minutes and dividing by 60

    Please change your formula as follows:

     

    Shift Worked1 =
    DATEDIFF (
        'Logistics Shift Work'[Start Time],
        'Logistics Shift Work'[End Time],
        MINUTE
    ) / 60 - 'Logistics Shift Work'[Break Time]
    

     

    Best Regards,
    Community Support Team _ Eason

2 Replies

  • v-easonf-msft's avatar
    v-easonf-msft
    Community Support

    Hi,  Anonymous 

    The result obtained by the DATEDIFF function is an integer, and it does not contain the decimal part. You can consider counting the result in minutes and dividing by 60

    Please change your formula as follows:

     

    Shift Worked1 =
    DATEDIFF (
        'Logistics Shift Work'[Start Time],
        'Logistics Shift Work'[End Time],
        MINUTE
    ) / 60 - 'Logistics Shift Work'[Break Time]
    

     

    Best Regards,
    Community Support Team _ Eason

  • Anonymous 

    pls try this

    Column = ('Table'[end]-'Table'[start])*24-'Table'[break time]