Forum Discussion

sathyaramesh's avatar
sathyaramesh
Icon for Advocate II rankAdvocate II
6 years ago

Calculate hours between two date/time column

Hi

I have a two calculated column
Col1 Col2
27-12-2019 04:35:00 28-12-2019 05:24:00

Need to calculate hours between col2-col1

Both column have date/time datatype

I need a total hours between the date.

Thanks in advance

21 Replies

  • Hi,

    Try this calculated column formula

    =Data[Col2]-Data[Col1]

    Format this column as Date/Time.

    Hope this helps.

      • Ashish_Mathur's avatar
        Ashish_Mathur
        Icon for Super User rankSuper User

        Hi,

        This calculated column formula works

        =DATEDIFF([Col1],[Col2],MINUTE)/60

        Hope this helps.

  • v-gizhi-msft's avatar
    v-gizhi-msft
    Icon for Community Support rankCommunity Support

    Hi,

     

    Please try this calculated column, and this can easily reach your requirement:

    Total Hour = DATEDIFF('Table'[Col 1],'Table'[Col 2],SECOND)/3600

    The result shows:

    If my answer has solved your issue, please mark it as a solution for others to see.

    Thanks!

     

    Best Regards,

    Giotto Zhi

    • sathyaramesh's avatar
      sathyaramesh
      Icon for Advocate II rankAdvocate II
      Hi
      I tried but i have a date/time column
      If i use that formula i am getting 0 for all rows

      Is there any other way to calculate?

      Thanks