Forum Discussion
Absence streak
- 2 years ago
Hi RudyL
Please refer tao attached sample file with the proposed solution - 2 years ago
Hi RudyL
You are right the ABSSTREAK calculated column. However I could not generate the other problem. Looks like the engine treats the blank as a zero anyway. I have a added a COALESCE statement as an additional layer to confirm the result.
Hi tamerj1 ,
First of all i'm amazed, surprised, in awe for your quick response and effort in trying to explain me how this works. First take-away on my side: There's a lot to learn.
But... it doesn't work for my data. After looking at your code and matching our data I found a couple of things:
1. I think you missed some checks on having multiple employees. My data has 350 while your example only has one. So I think I need to change your ABSSTREAK to the one below where an extra check on EMPID is included
Hi, RudyL
Thanks for tamerj1 reply. Can I ask if you have currently resolved the third issue? I used tamerj1's pbix file and then added DEPT_B with an ABSDATE of 1/1/2023, and the line corresponding to ABSSTARTFLAG seems to be the expected behavior. I don't understand what's wrong and if you can describe the effect you're looking for.
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
- RudyL2 years agoHelper I
Hi Anonymous ,
Thanks for your curiosity. But try the table below in which I inserted a second employee (513020) from a different department in the same data that tamerj1 used (just the 513019). When you take this dataset you will see that the calculations will be completely different, and wrong.
DEPT EMPID ABSDATE ABSFLAG DEPT_B 513019 02/01/2023 1 DEPT_B 513019 04/01/2023 1 DEPT_B 513019 05/01/2023 0 DEPT_B 513019 09/01/2023 1 DEPT_B 513019 11/01/2023 0 DEPT_B 513019 12/01/2023 0 DEPT_B 513019 16/01/2023 0 DEPT_A 513020 18/01/2023 1 DEPT_B 513019 18/01/2023 1 DEPT_A 513020 19/01/2023 0 DEPT_B 513019 19/01/2023 0 DEPT_B 513019 23/01/2023 0 DEPT_A 513020 23/01/2023 1 DEPT_B 513019 25/01/2023 1 DEPT_B 513019 26/01/2023 1 DEPT_B 513019 27/01/2023 1 DEPT_A 513020 27/01/2023 0 DEPT_B 513019 30/01/2023 1 DEPT_B 513019 31/01/2023 1 DEPT_B 513019 01/02/2023 1 DEPT_B 513019 02/02/2023 1 DEPT_A 513020 02/02/2023 1 DEPT_A 513020 03/02/2023 1 DEPT_B 513019 03/02/2023 1 DEPT_B 513019 06/02/2023 0 DEPT_B 513019 08/02/2023 0