Forum Discussion
help needed with a measure
Hi All,
I am looking for a measure in power BI desktop that will allow me create a sum of various rows based on specific criteria.
The criteria being the name of employee and the start of week date (first and second columns in the sample below)
i need to calculate how many hours are being worked by the same individual on the same week and have that info displayed into a new column (column 7: total hours)
The reason why i need this displayed in a new column is because i will then use that input in column 7 to create a new formula in column 9.
i am good to go with the latter part of the exercise but my problem is that i am not being able to come up with a way to give me the sum of hours per week per employee.
your help is appreciated.
Thank you.
| Employee | start of week date | Assignment name | Type of assignment | hours worked | employment type | Total Hours | Total Overhead | Total Hours Adjusted |
| X | Sunday july 3, 2016 | a | Not Overhead | 18 | exempt | 39 | 9 | 39 |
| X | Sunday july 3, 2016 | overhead | Overhead | 9 | exempt | 39 | 9 | 39 |
| X | Sunday july 3, 2016 | b | Not Overhead | 0 | exempt | 39 | 9 | 39 |
| X | Sunday july 3, 2016 | c | Not Overhead | 12 | exempt | 39 | 9 | 39 |
| X | Sunday july 3, 2016 | a | Not Overhead | 18 | exempt | 40 | 9 | 40 |
| X | Sunday july 3, 2016 | overhead | Overhead | 9 | exempt | 40 | 9 | 40 |
| X | Sunday july 3, 2016 | b | Not Overhead | 0 | exempt | 40 | 9 | 40 |
| X | Sunday july 3, 2016 | c | Not Overhead | 13 | exempt | 40 | 9 | 40 |
| X | Sunday july 3, 2016 | a | Not Overhead | 18 | exempt | 54 | 23 | 40 |
| X | Sunday july 3, 2016 | overhead | Overhead | 9 | exempt | 54 | 23 | 40 |
| X | Sunday july 3, 2016 | b | Not Overhead | 0 | exempt | 54 | 23 | 40 |
| X | Sunday july 3, 2016 | c | Not Overhead | 13 | exempt | 54 | 23 | 40 |
| X | Sunday july 3, 2016 | overhead | Overhead | 14 | exempt | 54 | 23 | 40 |
| Y | Sunday july 3, 2016 | a | Not Overhead | 18 | Non - Exempt (Hourly) | 39 | 9 | 39 |
| Y | Sunday july 3, 2016 | overhead | Overhead | 9 | Non - Exempt (Hourly) | 39 | 9 | 39 |
| Y | Sunday july 3, 2016 | b | Not Overhead | 0 | Non - Exempt (Hourly) | 39 | 9 | 39 |
| Y | Sunday july 3, 2016 | c | Not Overhead | 12 | Non - Exempt (Hourly) | 39 | 9 | 39 |
| Y | Sunday july 3, 2016 | a | Not Overhead | 18 | Non - Exempt (Hourly) | 40 | 9 | 40 |
| Y | Sunday july 3, 2016 | overhead | Overhead | 9 | Non - Exempt (Hourly) | 40 | 9 | 40 |
| Y | Sunday july 3, 2016 | b | Not Overhead | 0 | Non - Exempt (Hourly) | 40 | 9 | 40 |
| Y | Sunday july 3, 2016 | c | Not Overhead | 13 | Non - Exempt (Hourly) | 40 | 9 | 40 |
| Y | Sunday july 3, 2016 | a | Not Overhead | 18 | Non - Exempt (Hourly) | 54 | 23 | 54 |
| Y | Sunday july 3, 2016 | overhead | Overhead | 9 | Non - Exempt (Hourly) | 54 | 23 | 54 |
| Y | Sunday july 3, 2016 | b | Not Overhead | 0 | Non - Exempt (Hourly) | 54 | 23 | 54 |
| Y | Sunday july 3, 2016 | c | Not Overhead | 13 | Non - Exempt (Hourly) | 54 | 23 | 54 |
| Y | Sunday july 3, 2016 | overhead | Overhead | 14 | Non - Exempt (Hourly) | 54 | 23 | 54 |
Try
Column = CALCULATE(SUM(Table[hours worked]), ALLEXCEPT(Table, Table[Employee], Table[start of week date]))
EDIT: I'm a bit confused, do you want a measure or a column?
3 Replies
- RannehFrequent Visitor
had a typo with the dates, here is the right sample
Employee start of week date Assignment name Type of assignment hours worked employment type Total Hours Total Overhead Total Hours Adjusted X Sunday july 3, 2016 a Not Overhead 18 exempt 39 9 39 X Sunday july 3, 2016 overhead Overhead 9 exempt 39 9 39 X Sunday july 3, 2016 b Not Overhead 0 exempt 39 9 39 X Sunday july 3, 2016 c Not Overhead 12 exempt 39 9 39 X Sunday july 10, 2016 a Not Overhead 18 exempt 40 9 40 X Sunday july 10, 2016 overhead Overhead 9 exempt 40 9 40 X Sunday july 10, 2016 b Not Overhead 0 exempt 40 9 40 X Sunday july 10, 2016 c Not Overhead 13 exempt 40 9 40 X Sunday july 17, 2016 a Not Overhead 18 exempt 54 23 40 X Sunday july 17, 2016 overhead Overhead 9 exempt 54 23 40 X Sunday july 17, 2016 b Not Overhead 0 exempt 54 23 40 X Sunday july 17, 2016 c Not Overhead 13 exempt 54 23 40 X Sunday july 17, 2016 overhead Overhead 14 exempt 54 23 40 Y Sunday july 3, 2016 a Not Overhead 18 Non - Exempt (Hourly) 39 9 39 Y Sunday july 3, 2016 overhead Overhead 9 Non - Exempt (Hourly) 39 9 39 Y Sunday july 3, 2016 b Not Overhead 0 Non - Exempt (Hourly) 39 9 39 Y Sunday july 3, 2016 c Not Overhead 12 Non - Exempt (Hourly) 39 9 39 Y Sunday july 10, 2016 a Not Overhead 18 Non - Exempt (Hourly) 40 9 40 Y Sunday july 10, 2016 overhead Overhead 9 Non - Exempt (Hourly) 40 9 40 Y Sunday july 10, 2016 b Not Overhead 0 Non - Exempt (Hourly) 40 9 40 Y Sunday july 10, 2016 c Not Overhead 13 Non - Exempt (Hourly) 40 9 40 Y Sunday july 17, 2016 a Not Overhead 18 Non - Exempt (Hourly) 54 23 54 Y Sunday july 17, 2016 overhead Overhead 9 Non - Exempt (Hourly) 54 23 54 Y Sunday july 17, 2016 b Not Overhead 0 Non - Exempt (Hourly) 54 23 54 Y Sunday july 17, 2016 c Not Overhead 13 Non - Exempt (Hourly) 54 23 54 Y Sunday july 17, 2016 overhead Overhead 14 Non - Exempt (Hourly) 54 23 54