The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
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
User | Count |
---|---|
68 | |
63 | |
59 | |
54 | |
28 |
User | Count |
---|---|
183 | |
80 | |
62 | |
46 | |
38 |