Hey folks, I help with an expression I’m having trouble with writing.
I have an application for managing weekly schedules for people on duty.
I have two tables.
A SCHEDULE table - how a list of weekdays listing which user is assigned to which day.
(Jane has Monday’s date, Mark has Tues. date, etc.).
[User] - list the user
[Day] - list the date of the weekday
A SHIFT table - listing specific days user has traded
(Jane covering Tues. 2/4/20, Mark covering Fri. 2/7/20 etc. )
[User] - list the user
[Request Start] - list the date the shift starts
[Request End] - list the date the shift ends
[Trade?] - list if they need to trade
I need an Action expression that grabs the user’s next scheduled date from the SCHEDULE table and add it to the SHIFT table if the date is not already in there.
(In English, If the user wants to trade a shift that hasn’t already requested, their next scheduled shifts will be automatically added in the SHIFT table entry.)
Here’s what i wrote as an action in the SHIFTS tale
MIN(SELECT(Schedule[Day],
AND([Day] >= [_THISROW].[Shift Start],
[Day] <= [_THISROW].[Shift End],
[User] = [_THISROW].[User],
[Trade?] = "Yes",
)))
I wrote is as “If the user indicated they want to trade, select the user’s next scheduled date from the Schedule Table. Filter the value by the date after the user Request Start field and before the Request End field”
However, it’s grabbing the wrong date. I’ve been stuck for a while and could use some assistance. Is anyone willing to lend a hand?
Solved! Go to Solution.
Just a follow up guys. I figured it out
NOT(IN([Next Shift], The Shifts[Nom Shift]))
This omits every date in the Schedule sheet that was already in the Shift sheet.
Therefore i get the users’ earliest date not already covered in the “Vacay” entry, as expected.
Without this, i was getting the Moderator’s earliest date, covered or not.
I sent a screenshot of the result.
In any case, just wanted to let you guys know how I solved it.
User | Count |
---|---|
16 | |
8 | |
7 | |
3 | |
2 |