G
Guest
I need to calculate the average earnings for employees for their last five
years of employment. Does anyone know how to do this? The table is set up
with multiple rows for each employee, ie:
employee id begin_date end_date earnings
123456 1/1/2004 12/31/2004 $35,000
123456 6/1/2003 12/31/2003 $30,000
123456 1/1/2002 12/31/2002 $27,000
123456 1/1/2001 12/31/2001 $25,000
123456 1/1/2000 12/31/2000 $22,000
654321 1/1/1992 12/31/1992 $55,000
654321 1/1/1991 12/31/1991 $53,000
654321 1/1/1990 12/31/1990 $50,000
654321 1/1/1989 12/31/1989 $45,000
654321 1/1/1988 12/31/1988 $40,000
654321 1/1/1987 12/31/1987 $38,000
Obviously some employees will have more/less than five years of employment,
and their dates of employment range to as early as the 1970s. I'd like to
just obtain their average annual earnings for each of their last five years
of employment. Any help is greatly appreciated. Thanks!
years of employment. Does anyone know how to do this? The table is set up
with multiple rows for each employee, ie:
employee id begin_date end_date earnings
123456 1/1/2004 12/31/2004 $35,000
123456 6/1/2003 12/31/2003 $30,000
123456 1/1/2002 12/31/2002 $27,000
123456 1/1/2001 12/31/2001 $25,000
123456 1/1/2000 12/31/2000 $22,000
654321 1/1/1992 12/31/1992 $55,000
654321 1/1/1991 12/31/1991 $53,000
654321 1/1/1990 12/31/1990 $50,000
654321 1/1/1989 12/31/1989 $45,000
654321 1/1/1988 12/31/1988 $40,000
654321 1/1/1987 12/31/1987 $38,000
Obviously some employees will have more/less than five years of employment,
and their dates of employment range to as early as the 1970s. I'd like to
just obtain their average annual earnings for each of their last five years
of employment. Any help is greatly appreciated. Thanks!