Forum Discussion
Fill up or down based on conditions
- 3 years ago
The easy (but ugly) way of doing this is to:
1. Create 3 index columns starting at 1,2,3
2. Do a self merge with index column 2 and index column 1 as the join columns
3. Do the same for index column 2 and index column 3.
4. Expand the join columns.
5. Rename the 2nd weekcategory column (the first join result) as "Prevweekcategory" similar for the id_employee
6.Rename the 2nd weekcategory column (the first join result) as "Nextweekcategory" similar for the id_employee
Now add a new column "Fixedweekcategory" with the logic to pick either the appropiate weekcategory based on if the current weekcategory is blank and if the current employee id matches the next or previous employee id.
The easy (but ugly) way of doing this is to:
1. Create 3 index columns starting at 1,2,3
2. Do a self merge with index column 2 and index column 1 as the join columns
3. Do the same for index column 2 and index column 3.
4. Expand the join columns.
5. Rename the 2nd weekcategory column (the first join result) as "Prevweekcategory" similar for the id_employee
6.Rename the 2nd weekcategory column (the first join result) as "Nextweekcategory" similar for the id_employee
Now add a new column "Fixedweekcategory" with the logic to pick either the appropiate weekcategory based on if the current weekcategory is blank and if the current employee id matches the next or previous employee id.