Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Row context filter in table having issues

Hi, Having an issue in solving this simple problem. so I have a table lets say employeehours having following data:     The requirement is to have hours worked by employees and a calculatio...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous,

    Please convert your date fields to the real date value first, then you can try to use the following calculated column formula to get tags based on summary work hour per week for each employee:

    Tag =
    VAR workhour =
        CALCULATE (
            SUM ( Employee[Hours worked] ),
            FILTER ( Employee, [Employee] = EARLIER ( Employee[Employee] ) )
                && YEAR ( [Date] ) = YEAR ( EARLIER ( Employee[Date] ) )
                && WEEKNUM ( [Date], 2 ) = WEEKNUM ( EARLIER ( Employee[Date] ), 2 )
        )
    RETURN
        IF (
            workhour <= 50,
            "No Fatigue",
            IF ( workhour > 50 && workhour <= 60, "Close to fatigue", "High fatigue" )
        )

    Regards,

    Xiaoxin Sheng