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.
Bit stuck with this one!
I've been asked to provide a count of planned works that have any part of the planned duration, during working hours.
I have a Reference, and 2 date/times, and I want to derive a final column as a Yes/No. Example data, with final column as the calculated column I want to return.
WorkID | Start | End | In working hours? |
WO1122 | 11/01/2021 19:00 | 11/01/2021 23:00 | No |
WO1234 | 11/01/2021 16:00 | 11/01/2021 19:00 | Yes |
WO1135 | 11/01/2021 09:00 | 11/01/2021 14:00 | Yes |
WorkID | Start | End | In working hours? |
WO1122 | 11/01/2021 19:00 | 11/01/2021 23:00 | No |
WO1234 | 11/01/2021 16:00 | 11/01/2021 19:00 | Yes |
WO1135 | 11/01/2021 09:00 | 11/01/2021 14:00 | Yes |
Working hours are 08:00 to 18:00, Monday to Friday.
I've got similar 'stuff' for working days, but that requires a calendar table with Working Days flagged. I don't think having every possible date/time in a table to flag a working hour is the way to go here, but am a bit stuck on the logic.
Any clues/ideas?
Thanks so much!
Solved! Go to Solution.
@silverdale9999 , Try a new column like
new column =
var _st = [Start].time // or time(hour([start]),minute([start]),Second([start]))
var _end = [end].time // or time(hour([end]),minute([end]),Second([end]))
return
if(_st<= time(18,0,0) && _end>=Time(8,0,0), "Yes", "No")
@silverdale9999 , Try a new column like
new column =
var _st = [Start].time // or time(hour([start]),minute([start]),Second([start]))
var _end = [end].time // or time(hour([end]),minute([end]),Second([end]))
return
if(_st<= time(18,0,0) && _end>=Time(8,0,0), "Yes", "No")
Thanks!! This works. (I've not fully tested, but seems to do what I am expecting 🙂 )
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
101 | |
86 | |
64 |