Greg_Deckler's avatar
Greg_Deckler
Community Champion
6 years ago

Overworked

Given a list of tasks with work hours and starting and ending dates, determine if an employee is overworked in any week.

 

Employee Weeks = 
    SELECTCOLUMNS(
        ADDCOLUMNS(
            FILTER(
                ADDCOLUMNS(
                    GENERATE(
                        DISTINCT('Table'[Employee Id]),
                        CALENDAR(MIN('Table'[Task Start Date]),MAX('Table'[Task Due Date]))
                    ),
                    "__IsWeekDay",IF(WEEKDAY([Date],3) < 5,TRUE(),FALSE())
                ),
                [__IsWeekDay] = TRUE()
            ),
            "__Work Hours",8
        ),
        "Employee Id",[Employee Id],
        "Date",[Date],
        "Work Hours",[__Work Hours]
    )

No RepliesBe the first to reply