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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Adams_Apple
Frequent Visitor

Overtime Dax Formulas

Hi All,

I know there are already a lot of posts on this topic, but I have scoured them all and can't seem to get this to work.
I need to be able to determine overtime hours per week per employee, as well as overtime hours for groups as a whole, and then eventuall use that to calculate overtime costs.

 

I can successfully calculate Overtime Hours with this measure, but it only works in a table where I am looking at employees by weeks. if i look at more than 1 employee or more than 1 week I run into a sum total issue. 

 

Overtime Hours =
IF(
(CALCULATE(SUMX(Employees,Employees[Hours Paid]), FILTER(Employees,Employees[Year] && Employees[Week of Year]))) > 40,
(CALCULATE(SUMX(Employees,Employees[Hours Paid]), FILTER(Employees,Employees[Year] && Employees[Week of Year]))) - 40,
0)

 

This measure appears to have be calculating the sum total, but for normal hours and overtime hours, it also doesnt display the hours per employee for some reason.

 

Measure = SUMX(
    SUMMARIZE( Employees,
        Employees[Hours Paid],
        "Value", IF(SUM(Employees[Hours Paid]) > 40, SUM(Employees[Hours Paid]) - 40, 0)
    ),
    [Value]
)
 
And then the sum total issues go on to effect the overtime pay..
 
Thank you so much for your help!
Adams_Apple_1-1740174094131.png

 


 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

Jihwan_Kim_1-1740199957055.png

 

Jihwan_Kim_0-1740199934892.png

 

Work Hours: = 
SUM( work_hours[work_hours] )

 

Overtime Hours: = 
VAR _t =
    ADDCOLUMNS (
        SUMMARIZE ( work_hours, 'calendar'[Start of Week], employee[name] ),
        "@overtime",
            IF ( [Work Hours:] > 40, [Work Hours:] - 40, 0 )
    )
RETURN
    SUMX ( _t, [@overtime] )

 

Overtime Pay: = 
VAR _t =
    ADDCOLUMNS (
        SUMMARIZE ( work_hours, 'calendar'[Start of Week], employee[name], employee[overtime_rate] ),
        "@overtimepay",
            IF ( [Work Hours:] > 40, [Work Hours:] - 40, 0 ) * employee[overtime_rate]
    )
RETURN
    SUMX(_t, [@overtimepay])

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

Jihwan_Kim_1-1740199957055.png

 

Jihwan_Kim_0-1740199934892.png

 

Work Hours: = 
SUM( work_hours[work_hours] )

 

Overtime Hours: = 
VAR _t =
    ADDCOLUMNS (
        SUMMARIZE ( work_hours, 'calendar'[Start of Week], employee[name] ),
        "@overtime",
            IF ( [Work Hours:] > 40, [Work Hours:] - 40, 0 )
    )
RETURN
    SUMX ( _t, [@overtime] )

 

Overtime Pay: = 
VAR _t =
    ADDCOLUMNS (
        SUMMARIZE ( work_hours, 'calendar'[Start of Week], employee[name], employee[overtime_rate] ),
        "@overtimepay",
            IF ( [Work Hours:] > 40, [Work Hours:] - 40, 0 ) * employee[overtime_rate]
    )
RETURN
    SUMX(_t, [@overtimepay])

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Absolutely awesome, thank you so much!!!!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.