Forum Discussion
Anonymous
4 years agoNot applicable
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...
- Anonymous4 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
Anonymous
4 years agoNot applicable
Hi Asish,
Thank you for getting back, PFA, have a look at calculation "IsFatigue" and you can see it is not calculating correctly in table. looks like some row context issues.
I could not attach a file here, so a google drive link for PBIX:
https://drive.google.com/file/d/1xij7GQaFglIN1rMulxERYFYbmFUYXiI4/view?usp=sharing
Ashish_Mathur
4 years agoSuper User
Hi,
All figures in that column are <50, so your formula is correct in returning "No fatigue" in all cells. Where's the problem. Besides, correct for the following:
- Format the Date column in the Employee table as a Date data type (not text)
- Ensure that the Calendar runs from 2024 to 2030 (the duration as seen in the Employee table)
- Create a relationship between 2 tables based on Date (Many to One and Single)