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
mtrevisiol
Helper IV
Helper IV

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:

 

mtrevisiol_0-1643041311207.png

 

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:

mtrevisiol_1-1643041488174.png

 

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.

1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
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

Vlianlmsft_1-1643336570714.png

 

 

Best Regards,
Liang
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

2 REPLIES 2
V-lianl-msft
Community Support
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

Vlianlmsft_1-1643336570714.png

 

 

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

Greg_Deckler
Super User
Super User

@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

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.