I'm looking for a way to determine whether an employee has fixed the problem directly for a customer. When an employee needs to return within 7 days, the problem was not solved.
Situations:
- The problem was solved immediately. Thus a positive score.
- Another employee has already tried to fix, but failed. For this employee still counts he fixed it immediately.
- The employee has returned to the customer and fixes the problem. No score since he has failed before.
- The employee has visited the customer, but a colleague had to visit to finally fix. Thus no score.
The dataset looks like this, I have faked the outcome:
Customer Date Employee Outcome_Fixed
1 1-8-2018 1 1
2 2-8-2018 4 0
2 8-8-2018 3 0
2 11-8-2018 4 0
3 3-8-2018 8 0
3 5-8-2018 7 1
4 6-8-2018 3 1
I need to be calculating that last column. Based on the customer, employee and date difference within or over 7 days. Anyone a clue on how to solve this? Been trying to use lead and lag, but since the amount of visits is unknown this failes.
Thanks!