March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
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.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
89 | |
84 | |
70 | |
51 |
User | Count |
---|---|
206 | |
143 | |
97 | |
79 | |
68 |