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 August 31st. Request your voucher.
Hi Community,
Please help with finding a duration between two time stamps.
I have the 3 columns, i.e., shift_date, shift_start_time, shift_end_time. As this is an evening shift, the endtime mostly falls the next day.
shift_date | shift_start_time | shift_end_time | working_hours |
5-Apr-21 | 6:00:00 PM | 2:30:00 AM | 16 |
I tried using
working_hours= DATEDIFF( 'table_1'[shift_start_time], 'table1'[shift_end_time], HOUR),
but it is not working for me.
Any reference to documents is also appreciated.
Thanks and Regards
Sabyasachi
Solved! Go to Solution.
@Anonymous,
This would work,
@Anonymous, what is the data type of the columns?
shift_end_time - will only have the time without a date?
Thank yo @SivaMani for looking into this. Here, data type is time (h:nn:ss AM/PM). Yes, the shift end time without a date, its always either the shift day or next day.
Regards
Sabyasachi
@Anonymous,
Try the below measure,
@SivaMani I am getting the output as rounded value even when we expect a fraction.
@Anonymous,
This would work,
@Anonymous, You're welcome! I am glad that it worked.
User | Count |
---|---|
11 | |
9 | |
6 | |
6 | |
5 |
User | Count |
---|---|
22 | |
14 | |
14 | |
9 | |
7 |