Forum Discussion

_JohnDee_'s avatar
_JohnDee_
Regular Visitor
2 years ago
Solved

Employee Schedule

Hi everyone,

 

I need to schedule employee start and end by half-hour, depending on an expected and needed number

 

Here are my data :

I need to calculate three more columns :

 

"Start" : number of employees that need to start at each half hour to reach the expected number

"End" : number of employees that need to start at each half hour. A work day last 8:30 hour for each employee, so this is start + 8:30

"PresentEmployee" : number of employees present at each half-hour (depending on start and end)

 

here is the results that i expected :

 

 

Hre is the results that i have with the following calculated columns, and i d'ont understand why...

 

 

START

 

Start = 
VAR CurrentNum = 'EmployeeSchedule'[Numéro de la demi-heure]
VAR ExpectedEmployees = 'EmployeeSchedule'[ExpectedEmployees]
VAR EmployeesPresent = 
    CALCULATE(
        SUM('EmployeeSchedule'[ExpectedEmployees]),
        FILTER(
            'EmployeeSchedule',
            'EmployeeSchedule'[Numéro de la demi-heure] < CurrentNum
        )
    )
RETURN
MAX(0, ExpectedEmployees - EmployeesPresent)

 

 

END

 

End = 
VAR CurrentNum = 'EmployeeSchedule'[Numéro de la demi-heure]
VAR EndNum = CurrentNum - 17
RETURN
IF(
    EndNum > 0,
    CALCULATE(
        SUM('EmployeeSchedule'[Start]),
        FILTER(
            'EmployeeSchedule',
            'EmployeeSchedule'[Numéro de la demi-heure] = EndNum
        )
    ),
    0
)

 

 

PresentEmployees

 

PresentEmployees = 
VAR CurrentNum = 'EmployeeSchedule'[Numéro de la demi-heure]
RETURN
CALCULATE(
    SUM('EmployeeSchedule'[Start]) - SUM('EmployeeSchedule'[End]),
    FILTER(
        'EmployeeSchedule',
        'EmployeeSchedule'[Numéro de la demi-heure] <= CurrentNum
    )
)

 

 

 Thank you very much

  • Anonymous's avatar
    Anonymous
    2 years ago

    Source Data. Here expected employees figures are randomly taken.

    To calculate the desired result I have added three additional columns named Duration,End Time and Max Employee

    Start

    End

    Present Employees

     

    If the same way out solves your problem then please accept this as your solution. Happy to help.

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Source Data. Here expected employees figures are randomly taken.

    To calculate the desired result I have added three additional columns named Duration,End Time and Max Employee

    Start

    End

    Present Employees

     

    If the same way out solves your problem then please accept this as your solution. Happy to help.

    • _JohnDee_'s avatar
      _JohnDee_
      Regular Visitor

      [update] it's ok, my actual formula for Present employees work perfectly [/update]

       

      So great ! I think it's perfect !

       

      But i can't the see Present employees colum formula. The last screenshot seems not to be the good one.

       

      Thank you so much 🙂

  • Anonymous's avatar
    Anonymous
    Not applicable

    Please check present employee formula. I have considered your formula only for the Present employee. If the overall solution is ok with you then please accept the same as the solution.