Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi Folks,
I have a table with some columns as below. The print screen below is a table from Power BI. This is perfect if I just want to see each employees' hours on a daily basis. However, I would like to calculate their over time hours. I want to add a column name OT and the formula if it's on Excel, it would be like this:
OT = If("Sum of Hours">8, "Sum of Hours" - 8, "No OT")
Other words, the 1 to 3 rows with 8 hours, the "OT" column will show "No OT" for the 9 hours will show 1.
How do I do this on Power BI? Do I need to write DAX? or I can do the quick measure? Please help. Thank you.
This is the data source (Table)
Solved! Go to Solution.
is this what you want?
Column 2 = if('Table'[Column]="OT", CALCULATE(sum('Table'[Hours]),ALLEXCEPT('Table','Table'[Date],'Table'[Employee]))-8,0)
Proud to be a Super User!
pls provide the sample data
Proud to be a Super User!
you can try this to create a column
Column = if(CALCULATE(sum('Table'[Hours]),ALLEXCEPT('Table','Table'[Date],'Table'[Employee]))>8,"OT","NOT OT")
Proud to be a Super User!
Thank you very much, it works perfect. Now, I want to calculate how many OT hours for each employee. I've tried something like this to create a new column but of course it didn't work.
is this what you want?
Column 2 = if('Table'[Column]="OT", CALCULATE(sum('Table'[Hours]),ALLEXCEPT('Table','Table'[Date],'Table'[Employee]))-8,0)
Proud to be a Super User!
Sorry for the delay. Yours look exactly what I need but when I applied the code to mine, the calculation is totally off. I don't know what happened. Thank you so much for your time.😊🙏
pls provide the sample data
Proud to be a Super User!
Good morning Ryan. Thank you very much for following up. I think I don't need further assistance because the report that I downloaded did indicate the OT hours for each employee outside of the normal hours. That way, I can just filter them out when I did the report. Thank you again for your help. Have a great day.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 38 | |
| 37 | |
| 28 | |
| 28 |
| User | Count |
|---|---|
| 124 | |
| 89 | |
| 73 | |
| 66 | |
| 65 |