Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
This question has been asked several times, but I wasn't able to make any of the solutions provided fit my scenario. I have a table with the following data:
Name, Date Worked, WeekEnding Date, Hours Worked, Work Order
I need to sum the Hours Worked by week by employee to determine overtime. I have used this formula for HoursPerWeek:
HoursPerWeek = calculate(
SUM(R550618NLK[Hours]),
filter(R550618NLK,R550618NLK[WeekEnding])
)
But finding Overtime is challenging me! I have tried:
OT = if([HoursPerWeek]>40,[HoursPerWeek] - 40,BLANK())
This works when I look at individual employees, but this doesn't sum up correctly in a matrix.
I've also tried using my Measure, HoursPerWeek:
Total OT =
CALCULATE (
SUMX (
MsrTable,
IF (
[HoursPerWeek] > 40,
[HoursPerWeek] - 40,
BLANK()
)
)
)
But this gives me blank.
What is the correct formula?
Help will be much appreciated!
Solved! Go to Solution.
Hi @barbforsman,
Could you try the OT formula as:
OT = if([HoursPerWeek]>40,[HoursPerWeek] - 40*[EmployeeCount],BLANK())
hi @barbforsman,
This measure also seems to work
OTHours = CALCULATE ( SUMX ( SUMMARIZE ( R550618NLK, [WeekEnding], [Name], "Overtime", MAX ( [HoursPerWeek] - 40, 0 ) ), [Overtime] ), ALL ( R550618NLK[Pay Type] ) )
however I would also check it, especially if an employee job title could change during the week.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
95 | |
77 | |
65 | |
53 |
User | Count |
---|---|
144 | |
105 | |
102 | |
89 | |
63 |