We help IT Professionals succeed at work.

# Calculating an employee's performance versus goals

on
Hi Experts, I have a group of employees in a sales department who are paid based on actual results versus goals in the region(s) where they work.  An employee can work in one region for the entire year, or they can have a mid-year move between one region and another, or they can be shared across regions, or they can have a combination of these scenarios (see Employee_tbl for some examples).

Actual results for regions are reported monthly as the year progresses, with the latest month reported shown in the Period_tbl.  Goals are known for all 12 months of the year for each region.  For the length of each assignment, the sum of Actual results is compared to the sum of the Goals.  But, I’m looking for a full-year estimate of performance, and for any unreported months of an assignment, the Goal is used as a proxy for the Actual results.  For example, Employee_001’s Actual results would be calculated by taking the sum of the Actual results for RegA from Jan through Sep and then adding the Goals from Oct through Dec. (i.e. 920 + 230).  Employee_001’s Goals would be calculated by taking the sum of the goals from Jan through Dec (i.e. 1,060) – please see Performance_tbl.

The output that I am looking for via a query is a value for the Actual results and a value for the Goals, for each assignment, for each employee, as shown in the Output_tbl.  Thank you.
EE-MA-sample.mdb
Comment
Watch Question

## View Solution Only

MIS Liason
Most Valuable Expert 2012

Commented:
Perhaps this is just sample data and this may be irrelevent...

The first thing I will say is that the employee table should be a table of only the unique employees.
tblEmployees
EmpID
EmpName
...etc
(Things specific to each employee)

Now, if one employee can have many regions, then you need a Many-To-many table:

tblEmpRegions
EmpID
RegionID
StartDate
EndDate

You also need this to be linked to a unique Regions table
tblRegions
RegionID
RegionName
...etc
(Things specific to the Region)

Let's see if an expert can come along and address your question directly....

JeffCoachman

Commented:
Jeff, thank you.  I follow your points, but these tables are coming from another source as is, so this is what I have to work with
Senior Consultant
Most Valuable Expert 2011
Top Expert 2013

Commented:
Do you need it to be a query or could it be code behind a form that produces a report, display, or puts the information into a table for later use in reporting?

mlmcc

Commented:
Test this:
EE-MA-sample.mdb
Open Query1. Results differs from your sample, but I think it should be correct.
You can set period in table Period_tbl
Retired IT Professional

Commented:
Show how do you manually calculate the Actual, and Goal columns shown in the Output_tbl.

Commented:
als315,

when I keep the month as 12, your numbers tie to mine for RegA assignments, but not for the other assignments and also not when I change the month.

I changed the period back to 9, to reflect the Performance table where I only had results through Sep, and this also tests the different ways the calculations have to work.  Employee_001's Actual Results should be calculated by taking the sum of the Actual results for RegA from Jan through Sep and then adding the Goals for RegA from Oct through Dec. (i.e. 920 + 230).  Employee_001’s Goals would be calculated by taking the sum of the goals from Jan through Dec (i.e. 1,060).  In other words, for any assignment where the end date is later than the Period month, I assume that the Actual results are going to match the Goals.

To give you another example of the last sentence, with the period still set at 9: for Employee_002, their actual results for the RegB assignment should be calculated by taking the sum of the Actual results from May through Sep (1,300 + 1,100 + 1,000 + 800 + 900) and then adding the Goals from Oct through Dec (1,100 + 700 + 500) for a total of 7,400.  Their Goals would be calculated by taking the sum of the goals from May through Dec, i.e. 6,500.

Hope this helps.
Commented:
OK, test new version. Results are in Query2. Weight is already calculated. EE-MA-sample.mdb
Owner, Dev-Soln LLC
Most Valuable Expert 2014
Top Expert 2010

Commented:
I responded in the Experts area, but I'll put it here for good measure.

When you nest queries like this, you should always explicitly declare the parameters you are using.  In this case the reference to the combo box.  You can do this by adding the following line to the top of the SQL string of qry_HR.

PARAMETERS [Forms]![frm_Year_Selection]![cbo_Year] Text ( 255 );

But when I run this, no matter which "year" I select, I get the same results, so I assume that you need to do some modifications to the criteria of qry_HR.

Commented:
Sorry for the delay in closing this one out (other projects to manage), but this solution worked perfectly.