Forum Discussion
calculate % based on multiple criteria
- Anonymous2 years ago
Hi bree_carter
Please try this:
With your data, I create a calcualte column:
Calculated Shift = VAR _sumHours = CALCULATE( SUM('Table'[Hours]), FILTER('Table', 'Table'[Date]=EARLIER('Table'[Date]) && 'Table'[Employee Id]=EARLIER('Table'[Employee Id]) ) ) //Get the sum of the Hours separately RETURN 'Table'[Hours]/_sumHoursSelect the Column(Calculated Shift) > Column tools > Change the Display the values in this column with commas as a thousand separator to 2
The result is as follow:
Best Regards,
Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks and apologies.
I have a payroll extract that shows hours per person per day. A person may have more than one type of entry for a day (shown in the yellow highlight above). IE: in one day, a person may have some worked hours and some paid leave hours.
I need to convert this information:
- CURRENTLY: hours, per person, per day, per worked shift or leave type
- REQUIRE: calculated shift (Decimal format (to 2 decimal places)), per person, per day, per worked shift or leave type
What I am trying to obtain is in column E in the above image.
An example would be: on 01/01/24, EMP001 worked 0.7 of a shift and had 0.3 of a shift as LWOP -Planned.
The headings are as per the report that comes out of the system.
Data is below. Thanks for your time. 🙂
| Employee Id | Date | Hours | Time Off Name | Calculated Shift |
| EMP001 | 1/01/2024 | 8 | Worked Shift | |
| EMP001 | 1/01/2024 | 4 | LWOP - Planned | |
| EMP001 | 2/01/2024 | 12 | Planned Annual Leave | |
| EMP001 | 3/01/2024 | 12 | Worked Shift | |
| EMP001 | 4/01/2024 | 12 | Worked Shift | |
| EMP001 | 5/01/2024 | 5 | Personal Leave - Unplanned | |
| EMP001 | 5/01/2024 | 5 | LWOP - Unplanned | |
| EMP001 | 6/01/2024 | 12 | Worked Shift | |
| EMP002 | 1/01/2024 | 10 | Worked Shift | |
| EMP002 | 2/01/2024 | 10 | Worked Shift | |
| EMP002 | 3/01/2024 | 10 | Planned Annual Leave | |
| EMP002 | 4/01/2024 | 12 | Worked Shift | |
| EMP002 | 5/01/2024 | 12 | Personal Leave - Unplanned | |
| EMP002 | 6/01/2024 | 7 | Worked Shift | |
| EMP002 | 6/01/2024 | 4 | LWOP - Unplanned |