Forum Discussion
Index Column for Consecutive Days Employee Worked
I have a table which contains numerous different columns (15 total) with information about an employee's working day. What I need to do is create an index column which shows me when an employee has worked consecutive days.
| Employee ID | Work Date | Index |
| 33453 | 10/25/20 | 1 |
| 33453 | 10/26/20 | 1 |
| 33453 | 10/27/20 | 1 |
| 33453 | 11/2/20 | 2 |
| 33453 | 11/3/20 | 2 |
| 33453 | 11/5/20 | 3 |
What I'm hoping to accomplish with this is to count the number of instances in the index to make comparisions. So in the above example, if I'm trying to determine if an employee worked 3 days in a row, by counting the index column I would be able to determine that yes, employee 33453 worked 3 days from 10/25/20 to 10/27/20.
Would this logic work and if so, how would I create the index column and then how would I do the count on the index column to determine the number of days?
Thank you.
3 Replies
- amitchandakSuper User
mvgust , I created a blog a few days back, where I did it start and end date. In your case, it only one date, See if that blog can still help
- AnonymousNot applicable
Hi mvgust ,
It would be easier with Power query. Please check the method if it fits your scenario.
https://community.powerbi.com/t5/Desktop/dax-grouping-consecutive-days/td-p/488880
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Hi mvgust ,
Could you tell me if your problem has been solved?
If it is, kindly Accept it as the solution. More people will benefit from it.
Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.
Best Regards,
Stephen Tao