Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Measure: if meets multiple conditions then return result of another measure.

Measure to determine whether there is overtime or not.
Conditions hours to considered as overtime are
If an employee works more than 144 hours per 4 weeks or 36 hours per week or 10 hours per day,  hours worked in excess of contract hours must be paid as overtime (125%) otherwise as 100%.
I have a table per employee where contract hours per period / week / day are defined and a measure to calculate the deviation contract hours & hours worked per day.

 

Deviation contract Hours = [Nett Time]-[ContractHours]

Deviation contract Hours to add up = if(countrows(values(DCalendar[Date]))=1,[Deviation contract Hours],sumx(values(DCalendar[Date]),[Deviation contract Hours]))

 

Many thanks in advance for your support

4 REPLIES 4
mahoneypat
Microsoft Employee
Microsoft Employee

The three criteria for overtime make this one a little tricky.  Here is a proposed approached:

 

  • Make 3 variables each of which summarizes the hours per employee in the different time blocks (days, weeks, and 4 weeks); you can add a column to your Date table which groups dates into 4 week blocks
  • For each, calculate the SUMX, subtracting the # of non-overtime hours on each row (10, 36, and 144, respectively)
  • Find the max of the 3 SUMX values, multiply that by 125%
  • Subtract the # of overtime hours from the total hours and multiply that by 100% rate
  • Add the 125% and 100% values to get total (if needed)

If you provide some sample data or pbix, I can write an expression to do the above.

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


lbendlin
Super User
Super User

This looks like a good start. Where are you stuck?

Anonymous
Not applicable

Dear Ibendlin,

 

I meantime figured out how to include a filter to determine whether an employee has a Fulltime or Parttime contract. Pls refer to measure Overtime (125%).

The last condition to determine whether the deviation contract hours should be paid as 100% or 125% is to check whether an employee worked 10 or more hours (=measure Nett Time) that particular day. My thought was to add an OR if Nett Time >=10 to the measure Overtime (125%), but I don’t know how to include this.

 

 

Deviation contract Hours = [Nett Time]-[ContractHours]

Overtime (125%) = Calculate([Nett Time],filter('ContractHours 1','ContractHours 1'[Weekday]=8 && ' ContractHours 1'[Value]>=36))-calculate([ContractHours],filter(' ContractHours 1',' ContractHours 1'[Weekday]=8 && ' ContractHours 1'[Value]>=36))

 

Again many thanks for your support, much appreciated !

 

Kind regards,

Natasja

Anonymous
Not applicable

Hi Ibendlin,

 

Many thanks for your feedback.

The measure "Deviation contract Hours to add up" is working correctly but this measure just gives me the diff between contract hours and hours worked. To determine whether the overtime should be paid as 100% or 125% I need to include the conditions If an employee works more than 144 hours per 4 weeks OR 36 hours per week OR 10 hours per day. If these conditions are met, the hours must be considered as 125% otherwise as 100%.

 

Thank you - Natasja

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.