locked
Average above more fields in database RRS feed

  • Question

  • Dear friends,
    I have a database of employees with fields:

    Name, Surname, Salary2010, Salary2011, Salary2012, Salary2013
    Jon, Smith, 1000,1200, 1220,1500
    How can I prepare calculated field AverageSalary from this four fields for every employee.
    Thanks a lot.
    Anna 

    Thursday, January 21, 2016 2:19 PM

Answers

  • make a query with these fields; and then created a calculated field i.e.

    Avg: ([Salary2010]+ [Salary2011]+ [Salary2012] + [Salary2013])/4

    this will work in the literal sense - - however ongoing you data is not normalized in being side-by-side and thus the query must be altered & updated each year.

    if you restructure the data into a database format then a query can be be perpetual i.e.

    ID - Period - Amount

    ID - Period - Amount

    ID - Period - Amount

    Thursday, January 21, 2016 2:52 PM
  • Hi Anna,

    For another way, I suggest you use a calculated field with “([Salary2010]+ [Salary2011]+ [Salary2012] + [Salary2013])/4” in employees table. For more information about adding a calculated field to a table, you could refer the link below:

    # Add a calculated field to a table
    https://support.office.com/en-us/article/Add-a-calculated-field-to-a-table-14a60733-2580-48c2-b402-6de54fafbde3

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Friday, January 22, 2016 6:13 AM

All replies

  • make a query with these fields; and then created a calculated field i.e.

    Avg: ([Salary2010]+ [Salary2011]+ [Salary2012] + [Salary2013])/4

    this will work in the literal sense - - however ongoing you data is not normalized in being side-by-side and thus the query must be altered & updated each year.

    if you restructure the data into a database format then a query can be be perpetual i.e.

    ID - Period - Amount

    ID - Period - Amount

    ID - Period - Amount

    Thursday, January 21, 2016 2:52 PM
  • Hi Anna,

    For another way, I suggest you use a calculated field with “([Salary2010]+ [Salary2011]+ [Salary2012] + [Salary2013])/4” in employees table. For more information about adding a calculated field to a table, you could refer the link below:

    # Add a calculated field to a table
    https://support.office.com/en-us/article/Add-a-calculated-field-to-a-table-14a60733-2580-48c2-b402-6de54fafbde3

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Friday, January 22, 2016 6:13 AM