How to divide the dates in quarter and how current quarter employee visible on grid

Hi all, I have a list of employees with there joining dates. and employee will receive bonus on the basis of quarter for example if xyz employee joined the firm on 1/1/2021 then he will fall under the quarter1 and so on. Now I want to divide the employee as per there joining dates in quarter. And always current quarter employee should visible on datagrid. How can I achieve this please guide me   Thanks in advanced
1 answers

Create a quarter entity with the right begin and enddate of that quarter. I would create a reference between this entity and the employee entity. Now create a microflow where you iterate over all the employee's. You can then use a XPath contstrained to retrieve the right quarter by checking that the day that the person joined should be bigger or equal with the start date of a quarter and smaller or equal to the enddate of that quarter. If you find the quarter then add this employee to the reference. This way you can easily select a quarter and see which employee's belong to that quarter. And do make sure that when creating a new employee you set this quarter in some after creation microflow.