Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hi Team,
I want to calculate difference in minutes for each one hour. 
If an employee logs in at 8:30 and logs out at 11:30, we want to calculate the time spent for each hourly interval. Here's how it should look:
For the 8-9 interval: 30 minutes
For the 9-10 interval: 60 minutes
For the 10-11 interval: 60 minutes
For the 11-12 interval: 30 minutes (because the logout time is at 11:30)
Sample data
| Emp Id | Emp Name | Job Title | Log In Time | Log Out Time | Dif in min | HourlyInterval | 
| 123 | Hari | Manager | 5/2/2024 8:25 | 5/2/2024 11:00 | 155 | 08-09 | 
| 123 | Hari | Manager | 5/2/2024 8:20 | 5/2/2024 8:25 | 5 | 08-09 | 
| 123 | Hari | Manager | 5/2/2024 11:34 | 5/2/2024 11:49 | 15 | 11-12 | 
| 123 | Hari | Manager | 5/2/2024 11:17 | 5/2/2024 11:32 | 15 | 11-12 | 
For record #1:
Please provide expected result using the sample data.
Business requirement is to track how many hours he was in online. And I am not expecting in the row I am adding this in matrix visual
I asked because you mentioned that "we want to calculate the time spent for each hourly interval" which I assumed you wanted to show each interval as a row.
I tried with this dax but not getting expected result
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.