Hello everyone, I have a question I'm struggling to answer. I have a dataset with a number of workers. For each of them, I have their start date (beginning_date) and end date (stopwork_date) of service for different departments.
I would like to obtain a table where I can see, for each month, the number of workers present.
I have more than 3000 workers. The first 4 records are just like the following:
I'm trying to have an output just like this, where I have the number of persons at work for each month:
Does anyone have a solution?
I would like to obtain a table where I can see, for each month, the number of workers present.
I have more than 3000 workers. The first 4 records are just like the following:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input byte(id department) str10(beginning_date stopwork_date) 1 1 "23/01/2023" "24/07/2023" 2 1 "14/04/2023" "21/06/2023" 3 2 "12/02/2023" "12/12/2023" 4 2 "17/03/2023" "15/09/2023" end
department | January2023 | February2023 | March2023 | |
1 | 345 | 367 | 355 | |
2 | 234 | 222 | 220 | |
3 | 123 | 134 | 130 | |
4 | 12 | 14 | 14 | |
5 | 245 | 248 | 247 |
Does anyone have a solution?
Comment