Forum Discussion

mtrevisiol's avatar
mtrevisiol
Helper V
4 years ago
Solved

Difference between two times

Hi everyone, 

I need to calculate the total minutes spent on working by each employee, by making the difference between a specific hour (08:30:00) and a column that contains the date and time they start working:

 

 

The new column MinutesOfWork would contain the difference in minutes between 08:30:00 of the day included in each row, and the hour reported on each row:

 

I tried to use DATEDIFF, but I don't know how to include the time as well as the date. How can I create it? Thank you so much.

  • Hi mtrevisiol ,

     

    Try to create a new column like below:

    Minutes of work = HOUR('Table'[dateend]- FORMAT('Table'[dateend],"YYYY-MM-DD 08:30:00"))*60

     

     

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

2 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    mtrevisiol You can add the time value by adding your date with + TIMEVALUE("8:30:00"). Alternatively you could just use subtraction and math like:

    Minutes of work = 
      ([DateEnd] - TRUNC([DateEnd])+ 8/24 + 30/24/60) * 60
  • V-lianl-msft's avatar
    V-lianl-msft
    Community Support

    Hi mtrevisiol ,

     

    Try to create a new column like below:

    Minutes of work = HOUR('Table'[dateend]- FORMAT('Table'[dateend],"YYYY-MM-DD 08:30:00"))*60

     

     

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