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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Todd23
New Member

Calculating Time difference

Hi, 

 

I am really struggling with some DAX formula's to calculate the difference in minutes between each of the previous rows.  

 

Todd23_0-1694096867021.png

For example, This tabke are checks which have to be completed every 60 minutes. I am trying to calculate how many minutes are between each. Then how many of those of checks lapse the 60 minute rule.

 

Any help on this would be appreciated!

 

1 ACCEPTED SOLUTION
DataNinja777
Super User
Super User

Hi @Todd23 ,

 

I've added the calculated column like below to obtain the previous test time.

Sakiko_0-1694125165118.png

Then, I subtracted the previous test time from the current test time to get the time elapsed since the last test:

Sakiko_1-1694125315214.png

 

For this exercise, I combined the date and time columns in order to deal with midnight testing scenarios (if it ever happens), even though the best practice is to separate out the date and time fields for reduced cardinarity.  

I've also added a field to show which test exceeded 1 hour from the previous test.  

Sakiko_2-1694126931077.png

I attach the pbix file in the link below:

Time since previous test.pbix

 

 

View solution in original post

1 REPLY 1
DataNinja777
Super User
Super User

Hi @Todd23 ,

 

I've added the calculated column like below to obtain the previous test time.

Sakiko_0-1694125165118.png

Then, I subtracted the previous test time from the current test time to get the time elapsed since the last test:

Sakiko_1-1694125315214.png

 

For this exercise, I combined the date and time columns in order to deal with midnight testing scenarios (if it ever happens), even though the best practice is to separate out the date and time fields for reduced cardinarity.  

I've also added a field to show which test exceeded 1 hour from the previous test.  

Sakiko_2-1694126931077.png

I attach the pbix file in the link below:

Time since previous test.pbix

 

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.