March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi Everyone!
I have one table that looks like this
Shift _Table | |||
StartDateTime | EndDateTime | Shift | EmployeeID |
1/1/2022 8:00 | 1/1/2022 18:00 | Day Shift | 1 |
1/1/2022 16:00 | 1/2/2022 2:00 | Swing Shift | 2 |
1/1/2022 23:00 | 1/2/2022 9:00 | Night Shift | 3 |
1/2/2022 8:00 | 1/2/2022 18:00 | Day Shift | 1 |
And Another table that looks like this
Transactions_Table | ||
TransactionID | TransactionDateTime | EmployeeID |
1 | 1/1/2022 17:30 | 1 |
3 | 1/1/2022 22:00 | 2 |
4 | 1/2/2022 4:30 | 3 |
5 | 1/2/2022 8:30 | 3 |
I want to join them so that if a transaction occurs during an employee's shift then they will get credit for that particular transaction on that particular shift. In other words, I'm trying to create something like this by combing the two tables above.
Goal_Table | |||
TransactionID | TransactionDate | EmployeeID | Shift |
1 | 1/1/2022 | 1 | Day Shift |
3 | 1/1/2022 | 2 | Swing Shift |
4 | 1/2/2022 | 3 | Night Shift |
5 | 1/2/2022 | 3 | Night Shift |
Any suggestions would be tremendously appreciated!!
Thank you!!
Hi
try this calculate column
Shift = MAXX (CALCULATETABLE(Transaction_table,EARLIER(TransactionDate)>StartDatetime,EARLIER(TransactionDate)<EndDatetime),Shift)
Hi @HoangHugo ,
Thank you so much for taking the time to respond! I'm trying to implement the solution you described, but PowerBI says it can't find the TransactionDate column even when I use SELECTEDVALUE(). Do you have any other relationships between the columns besides one between EmployeeIDs?
Thanks again for your help!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
89 | |
84 | |
70 | |
51 |
User | Count |
---|---|
206 | |
143 | |
97 | |
79 | |
68 |